Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crash regression in 6.1 #80269

Open
jpsim opened this issue Mar 25, 2025 · 3 comments
Open

Compiler crash regression in 6.1 #80269

jpsim opened this issue Mar 25, 2025 · 3 comments
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

Comments

@jpsim
Copy link
Contributor

jpsim commented Mar 25, 2025

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

@jpsim jpsim added 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 labels Mar 25, 2025
@jpsim
Copy link
Contributor Author

jpsim commented Mar 25, 2025

Crash looks a bit different in Swift 6 language mode:

$ DEVELOPER_DIR=/Applications/Xcode-16.3.0-Release.Candidate.app/Contents/Developer xcrun swiftc -O -swift-version 6 -enable-actor-data-race-checks crash_test.swift 
error: compile command failed due to signal 6 (use -v to see invocation)
BadInst:   %3 = extract_executor %0 : ${ var W<Int> }      // user: %10
<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: send-non-sendable: Found instruction that is not allowed to have non-Sendable parameters with such parameters?!
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 -swift-version 6 -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.JVsL13/crash_test-1.o
1.	Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
2.	Compiling with the current language version
3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for crash_test)
4.	While running pass #247 SILFunctionTransform "SendNonSendable" on SILFunction "@$s10crash_test1AC1fSiyYaF2$xL_AA1WVySiGvg".
 for getter for $x (at crash_test.swift:11:12)
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           0x000000010a8d6c28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x000000010a8d4a60 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010a8d7264 SignalHandler(int) + 360
3  libsystem_platform.dylib 0x000000018d08ade4 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018d053f70 pthread_kill + 288
5  libsystem_c.dylib        0x000000018cf60908 abort + 128
6  swift-frontend           0x0000000104acb764 swift::DiagnosticHelper::~DiagnosticHelper() + 0
7  swift-frontend           0x000000010a84667c llvm::report_fatal_error(llvm::Twine const&, bool) + 280
8  swift-frontend           0x000000010a846564 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
9  swift-frontend           0x0000000105338ca0 swift::regionanalysisimpl::PartitionOpTranslator::translateSILInstruction(swift::SILInstruction*) + 3128
10 swift-frontend           0x00000001053356a8 swift::RegionAnalysis::newFunctionAnalysis(swift::SILFunction*) + 2360
11 swift-frontend           0x000000010558b2d8 (anonymous namespace)::SendNonSendable::run() + 308
12 swift-frontend           0x00000001055c7810 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 3336
13 swift-frontend           0x00000001055c3c54 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 12100
14 swift-frontend           0x00000001055fec50 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 52
15 swift-frontend           0x00000001055e26e0 swift::ExecuteSILPipelineRequest::OutputType swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()>(swift::ExecuteSILPipelineRequest const&, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()) + 412
16 swift-frontend           0x00000001055e59e0 swift::runSILDiagnosticPasses(swift::SILModule&) + 416
17 swift-frontend           0x0000000104ae866c swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 656
18 swift-frontend           0x0000000104728d90 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*) + 1360
19 swift-frontend           0x00000001047280a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
20 swift-frontend           0x000000010472b654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
21 swift-frontend           0x0000000104729fd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
22 swift-frontend           0x00000001046ae0bc swift::mainEntry(int, char const**) + 5428
23 dyld                     0x000000018ccd4274 start + 2840

@tbkka
Copy link
Contributor

tbkka commented Mar 25, 2025

RegionAnalysis => @gottesmm

@gottesmm
Copy link
Contributor

@tbkka Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants