Closed
Description
Description
Latest available development snapshot of 6.2 crashes when compiling our code. See reproducer.
Compiles fine with
$ swift -version
swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0
Reproduction
import Foundation
import Synchronization
final class MessageCache<Message> {
let _predicates = Mutex<[Predicate<Message>]>([])
var predicates: [Predicate<Message>] {
_predicates.withLock { $0 }
}
}
Stack dump
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file a.swift -target arm64-apple-macosx15.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -color-diagnostics -Xcc -fcolor-diagnostics -empty-abi-descriptor -no-auto-bridging-header-chaining -module-name a -in-process-plugin-server-path /Library/Developer/Toolchains/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Library/Developer/Toolchains/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Library/Developer/Toolchains/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.5 -target-sdk-name macosx15.5 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -o /var/folders/y0/5ch3_9cs0x1fyzdykz2tbz4w0000gn/T/TemporaryDirectory.H5uve4/a-1.o
1. Apple Swift version 6.2-dev (LLVM 0d47fa0a0fd41fb, Swift 536aa932a9e0ea3)
2. Compiling with effective version 5.10
3. While evaluating request IRGenRequest(IR Generation for file "a.swift")
4. While emitting IR SIL function "@$s1a12MessageCacheC10predicatesSay10Foundation9PredicateVyx_QPGGvg".
for getter for predicates (at a.swift:7:9)
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 0x0000000108787b90 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x00000001087862bc llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x00000001087881d8 SignalHandler(int, __siginfo*, void*) + 296
3 libsystem_platform.dylib 0x0000000193f34624 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000193efa88c pthread_kill + 296
5 libsystem_c.dylib 0x0000000193e03c60 abort + 124
6 swift-frontend 0x000000010328da48 swift::DiagnosticHelper::create(swift::CompilerInstance&, swift::CompilerInvocation const&, llvm::ArrayRef<char const*>, llvm::raw_pwrite_stream&, bool) + 0
7 swift-frontend 0x0000000108705fc0 llvm::report_fatal_error(llvm::Twine const&, bool) + 256
8 swift-frontend 0x0000000108705ec0 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
9 swift-frontend 0x000000010357893c (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 83992
10 swift-frontend 0x00000001035630e4 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 8816
11 swift-frontend 0x0000000103560954 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1828
12 swift-frontend 0x00000001033fce9c 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&) + 788
13 swift-frontend 0x0000000103511844 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 2396
14 swift-frontend 0x000000010355fae4 swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 200
15 swift-frontend 0x000000010351906c 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'()) + 212
16 swift-frontend 0x000000010351371c 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**) + 208
17 swift-frontend 0x000000010306b388 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
18 swift-frontend 0x0000000103067ef0 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*) + 1372
19 swift-frontend 0x0000000103067328 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 468
20 swift-frontend 0x0000000103073adc withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
21 swift-frontend 0x0000000103069120 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
22 swift-frontend 0x00000001030688dc swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2312
23 swift-frontend 0x0000000102e0d28c swift::mainEntry(int, char const**) + 3064
24 dyld 0x0000000193b5ab98 start + 6076
Expected behavior
Compile without crash.
Environment
$ swiftc -version
Apple Swift version 6.2-dev (LLVM 0d47fa0a0fd41fb, Swift 536aa93)
Target: arm64-apple-macosx15.0
Build config: +assertions
Additional information
No response