Runtime crash from consume
inside _modify
#80233
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
crash
Bug: A crash, i.e., an abnormal termination of software
triage needed
This issue needs more specific labels
Description
There is a runtime crash caused by a
consume
expression inside a_modify
accessor.Reproduction
The issue can be reproduced by creating a Swift package with an executable target, pasting the following code snippet into its
main.swift
, then building and running the executable target.Stack dump
Expected behavior
The
example
function executes to completion and produces the following output:Environment
Additional information
Removing the
consume
keyword in the_traceMessageList = consume _nextTraceMessageList
statement resolves the issue.Based on this observation, it seems that the code generator may be emitting unconditional cleanup code after the
yield
statement for_nextTraceMessageList
even when it has been explicitly consumed during assignment to_traceMessageList
, causing the cleanup code to run on the same memory twice.The text was updated successfully, but these errors were encountered: