Skip to content

Compiler crash regression in 6.1 #80269

Open
@jpsim

Description

@jpsim

Description

Code that used to compile in Swift 6.0.3 now crashes the compiler with Swift 6.1.

Reproduction

Contents of crash_test.swift:

@propertyWrapper
struct W<T> {
  var wrappedValue: T
  var projectedValue: W { self }
}

actor A {
  @W var x = 1

  func f() async -> Int {
    @W var x = 2
    return await Task.detached {
      return $x.wrappedValue
    }.value
  }
}

This compiles with Swift 6.0.3 but not Swift 6.1:

$ DEVELOPER_DIR=/Applications/Xcode-16.2.0.app/Contents/Developer xcrun swiftc -O -enable-actor-data-race-checks crash_test.swift
$ echo $?
0
$ DEVELOPER_DIR=/Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer xcrun swiftc -O -enable-actor-data-race-checks crash_test.swift  
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-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file crash_test.swift -target arm64-apple-macosx15.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -color-diagnostics -O -enable-actor-data-race-checks -new-driver-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -module-name crash_test -disable-clang-spi -target-sdk-version 15.4 -target-sdk-name macosx15.4 -external-plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -in-process-plugin-server-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -enable-default-cmo -o /var/folders/d4/klf7m4jx3cgcdmz7n2sbsq5w0000gn/T/TemporaryDirectory.Illn3T/crash_test-1.o
1.	Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
2.	Compiling with effective version 5.10
3.	While evaluating request IRGenRequest(IR Generation for file "crash_test.swift")
4.	While emitting IR SIL function "@$s10crash_test1AC1fSiyYaFSiyYacfU_".
 for expression at [crash_test.swift:12:32 - line:14:5] RangeText="{
      return $x.wrappedValue
    "
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           0x0000000108e2ac28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000108e28a60 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108e2b264 SignalHandler(int) + 360
3  libsystem_platform.dylib 0x000000018d08ade4 _sigtramp + 56
4  swift-frontend           0x00000001032f1170 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 38616
5  swift-frontend           0x00000001032e638c (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 15860
6  swift-frontend           0x00000001032e20e0 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 2788
7  swift-frontend           0x000000010310799c swift::irgen::IRGenerator::emitLazyDefinitions() + 5288
8  swift-frontend           0x0000000103293ae4 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4528
9  swift-frontend           0x00000001032e133c swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 180
10 swift-frontend           0x000000010329cf28 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'()) + 812
11 swift-frontend           0x0000000103296688 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**) + 176
12 swift-frontend           0x0000000102c81af0 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
13 swift-frontend           0x0000000102c7d07c 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
14 swift-frontend           0x0000000102c7c0a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
15 swift-frontend           0x0000000102c7f654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
16 swift-frontend           0x0000000102c7dfd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
17 swift-frontend           0x0000000102c020bc swift::mainEntry(int, char const**) + 5428
18 dyld                     0x000000018ccd4274 start + 2840

Stack dump

0.	Program arguments: /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file crash_test.swift -target arm64-apple-macosx15.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -color-diagnostics -O -enable-actor-data-race-checks -new-driver-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -module-name crash_test -disable-clang-spi -target-sdk-version 15.4 -target-sdk-name macosx15.4 -external-plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -in-process-plugin-server-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -enable-default-cmo -o /var/folders/d4/klf7m4jx3cgcdmz7n2sbsq5w0000gn/T/TemporaryDirectory.Illn3T/crash_test-1.o
1.	Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
2.	Compiling with effective version 5.10
3.	While evaluating request IRGenRequest(IR Generation for file "crash_test.swift")
4.	While emitting IR SIL function "@$s10crash_test1AC1fSiyYaFSiyYacfU_".
 for expression at [crash_test.swift:12:32 - line:14:5] RangeText="{
      return $x.wrappedValue
    "
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           0x0000000108e2ac28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000108e28a60 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108e2b264 SignalHandler(int) + 360
3  libsystem_platform.dylib 0x000000018d08ade4 _sigtramp + 56
4  swift-frontend           0x00000001032f1170 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 38616
5  swift-frontend           0x00000001032e638c (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 15860
6  swift-frontend           0x00000001032e20e0 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 2788
7  swift-frontend           0x000000010310799c swift::irgen::IRGenerator::emitLazyDefinitions() + 5288
8  swift-frontend           0x0000000103293ae4 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4528
9  swift-frontend           0x00000001032e133c swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 180
10 swift-frontend           0x000000010329cf28 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'()) + 812
11 swift-frontend           0x0000000103296688 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**) + 176
12 swift-frontend           0x0000000102c81af0 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
13 swift-frontend           0x0000000102c7d07c 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
14 swift-frontend           0x0000000102c7c0a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
15 swift-frontend           0x0000000102c7f654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
16 swift-frontend           0x0000000102c7dfd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
17 swift-frontend           0x0000000102c020bc swift::mainEntry(int, char const**) + 5428
18 dyld                     0x000000018ccd4274 start + 2840

Expected behavior

Should compile with the Swift 6.1 compiler as it does in Swift 6.0.3.

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwaretriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions