Swift 6.1 runtime crash when calling @objc async protocol method in target with mixed Swift 5 and Swift 6 dependencies #81846
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
We are hitting an EXC_BAD_ACCESS runtime crash in
Swift.CheckedContinuation.resume(returning: __owned τ_0_0) -> () ()
when calling an@objc
async protocol method. This occurs when using the Swift 6.1 compiler and does not happen with Swift 6.0. It's reproducible only when there are both Swift 5 and Swift 6 language mode dependencies that include such protocols and the methods have the same return type.Reproduction
Repro steps:
Build and run the attached sample app with Xcode 16.3
RESULT: app crashes
We narrowed down the repro to a small project with 3 targets:
Static library compiled with Swift 5 language mode:
Similar static library but compiled with Swift 6 language mode:
App target that links in the above 2 libraries:
Observations:
Sendable
and making the classes final did not eliminate the crashawait Impl().doSomething() // no crash
Stack dump
Expected behavior
No crash should occur
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0
Additional information
Swift forums post: https://forums.swift.org/t/xcode-16-3-unsafecontinuation-resume-exc-bad-access-crash/79821
The text was updated successfully, but these errors were encountered: