-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Heap corruption when awaiting AsyncSequence in top level #65001
Copy link
Copy link
Closed
Labels
SILOptimizerArea → compiler: SIL optimization passesArea → compiler: SIL optimization passesasync & awaitFeature → concurrency: asynchronous function aka the async/await patternFeature → concurrency: asynchronous function aka the async/await patternbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresmemory corruptionoptimized onlyFlag: An issue whose reproduction requires optimized compilationFlag: An issue whose reproduction requires optimized compilationswift 5.8
Metadata
Metadata
Assignees
Labels
SILOptimizerArea → compiler: SIL optimization passesArea → compiler: SIL optimization passesasync & awaitFeature → concurrency: asynchronous function aka the async/await patternFeature → concurrency: asynchronous function aka the async/await patternbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresmemory corruptionoptimized onlyFlag: An issue whose reproduction requires optimized compilationFlag: An issue whose reproduction requires optimized compilationswift 5.8
Description
Awaiting AsyncSequence in top-level code causes runtime heap corruption in release build.
Steps to reproduce
Add https://github.com/apple/swift-async-algorithms to Package.swift and write the code below (
main.swift).And run.
This occurs only with top-level code. Therefore, I thought this is a compiler problem, not a swift-async-algorithms problem.
Any operator can be attached to an AsyncSequence.
For example,
also cause segmentation fault.
Expected behavior
Does not happen segmentation fault or heap corruption.
Environment
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
Xcode 14.3
Build version 14E222b
This also reproduces on Linux.