Compiler crash attempting to witness AsyncIteratorProtocol.next(isolation:) with a synchronous method
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 70.4k
- Forks
- 10.8k
- PR merge metrics
- PR metrics pending
Description
Description
Compiler crashes when attempting to witness AsyncIteratorProtocol.next(isolation:) with a synchronous method; adding async fixes the crash.
error: compile command failed due to signal 11 (use -v to see invocation)
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file WitnessNextIsolationWithoutAsync.swift -target arm64-apple-macosx15.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk -color-diagnostics -Xcc -fcolor-diagnostics -swift-version 6 -new-driver-path /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -no-auto-bridging-header-chaining -module-name WitnessNextIsolationWithoutAsync -disable-clang-spi -target-sdk-version 26.2 -target-sdk-name macosx26.2 -external-plugin-path /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -in-process-plugin-server-path /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-26.3.0-release.candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/jg/3hxr5hxx7hd3kcfjs1c7ylqr0000gp/T/TemporaryDirectory.Yi5hwE/WitnessNextIsolationWithoutAsync-1.o
1. Apple Swift version 6.2.4 (swiftlang-6.2.4.1.4 clang-1700.6.4.2)
2. Compiling with the current language version
3. While evaluating request IRGenRequest(IR Generation for file "WitnessNextIsolationWithoutAsync.swift")
4. While emitting IR SIL function "@$s32WitnessNextIsolationWithoutAsync02MyE8SequenceV0E8IteratorVScIAAScI4next9isolation7ElementQzSgScA_pSgYi_tYa7FailureQzYKFTW".
for 'next(isolation:)' (at WitnessNextIsolationWithoutAsync.swift:3:9)
5. While lowering use of witness method SIL decl '#Actor.unownedExecutor!getter'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x00000001070b3740 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x00000001070b10d0 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x00000001070b3d6c SignalHandler(int, __siginfo*, void*) + 344
3 libsystem_platform.dylib 0x0000000197b216a4 _sigtramp + 56
4 swift-frontend 0x00000001013b05d0 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 40060
5 swift-frontend 0x00000001013b05d0 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 40060
6 swift-frontend 0x00000001013a5284 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 15996
7 swift-frontend 0x00000001013a0fdc swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 2836
8 swift-frontend 0x00000001011b77c4 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 2176
9 swift-frontend 0x0000000101351370 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4296
10 swift-frontend 0x000000010139fd88 swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 180
11 swift-frontend 0x0000000100c87204 swift::IRGenRequest::OutputType swift::Evaluator::getResultUncached<swift::IRGenRequest, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()>(swift::IRGenRequest const&, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()) + 368
12 swift-frontend 0x000000010135407c swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 168
13 swift-frontend 0x0000000100ce6a74 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>) + 156
14 swift-frontend 0x0000000100ce2088 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 2108
15 swift-frontend 0x0000000100ce1084 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
16 swift-frontend 0x0000000100ce43b8 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
17 swift-frontend 0x0000000100ce2fc8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3580
18 swift-frontend 0x0000000100c60408 swift::mainEntry(int, char const**) + 5412
19 dyld 0x0000000197746b98 start + 6076
Reproduction
struct MyAsyncSequence: AsyncSequence {
struct AsyncIterator: AsyncIteratorProtocol {
func next(isolation: isolated (any Actor)? = #isolation) -> Int? {
nil
}
}
func makeAsyncIterator() -> AsyncIterator {
AsyncIterator()
}
}
swiftc -swift-version 6 WitnessNextIsolationWithoutAsync.swift
Expected behavior
Don't crash
Environment
swift-driver version: 1.127.15 Apple Swift version 6.2.4 (swiftlang-6.2.4.1.4 clang-1700.6.4.2)
Target: arm64-apple-macosx15.0
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the provided WitnessNextIsolationWithoutAsync.swift reproduction with swiftc -swift-version 6. Trace the reported IRGenRequest and IRGenSILFunction path while lowering the witness method for next(isolation:). Done means the reproduction no longer crashes and equivalent coverage verifies the compiler reports or handles the synchronous witness safely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100