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

SendNonSendable Crash: "constructing SILType with type that should have been eliminated by SIL lowering" #78439

Open
bc-lee opened this issue Jan 5, 2025 · 1 comment · May be fixed by #78440
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself concurrency Feature: umbrella label for concurrency language features crash Bug: A crash, i.e., an abnormal termination of software SIL

Comments

@bc-lee
Copy link
Contributor

bc-lee commented Jan 5, 2025

Description

The Swift compiler crashes during the SendNonSendable SIL pass. The crash seems to be caused by constructing a SILType with a type that should have been eliminated by SIL lowering.

Reproduction

Compile the following Swift code with -swift-version 5 -enable-upcoming-feature StrictConcurrency and the latest Swift Development snapshot (swift-DEVELOPMENT-SNAPSHOT-2025-01-03):

import Foundation

class M {
    private var handler: ((Any?, @escaping (Any?) -> Void) -> Void)?

    func setHandler(_ handler: ((Any?, @escaping (Any?) -> Void) -> Void)?) {
        self.handler = handler
    }
}

protocol Api {
    func getString(completion: sending @escaping (Result<String?, Error>) -> Void)
}

final class ApiImpl: Sendable, Api {
    func getString(completion: sending @escaping (Result<String?, any Error>) -> Void) {
        DispatchQueue.global(qos: .default).async {
            completion(.success(nil))
        }
    }
}

class ApiSetup {
    static func setUp(api: Api?) {
        let m = M()
        if let api = api {
            m.setHandler {
                (_: Any, reply: @escaping ((sending Any?) -> Void)) in
                api.getString { (result: Result<String?, Error>) in
                    switch result {
                    case .success(let res):
                        reply(res)
                    case .failure(let error):
                        reply(error)
                    }
                }
            }
        }
        else {
            m.setHandler(nil)
        }
    }
}

Stack dump

First version with Development snapshot(swift-DEVELOPMENT-SNAPSHOT-2025-01-03):

Stack dump
Assertion failed: (ty->isLegalSILType() && "constructing SILType with type that should have been " "eliminated by SIL lowering"), function SILType, file SILType.h, line 114.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2025-01-03-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file main.swift -target x86_64-apple-macosx15.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -swift-version 5 -enable-upcoming-feature StrictConcurrency -empty-abi-descriptor -resource-dir /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2025-01-03-a.xctoolchain/usr/lib/swift -module-name a -in-process-plugin-server-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2025-01-03-a.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2025-01-03-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2025-01-03-a.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.2 -target-sdk-name macosx15.2 -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/_5/lf5n932s1v91zjwvw4pxr1rw0000gn/T/TemporaryDirectory.7eiwn2/main-1.o
1.	Apple Swift version 6.2-dev (LLVM 06a77c5cc0ff511, Swift 8e9f7b657285063)
2.	Compiling with effective version 5.10
3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for a)
4.	While running pass #335 SILFunctionTransform "SendNonSendable" on SILFunction "@$s1a8ApiSetupC5setUp3apiyAA0A0_pSg_tFZyyp_yypSgnYuctcfU_".
 for expression at [main.swift:27:26 - line:37:13] RangeText="{
                (_: Any, reply: @escaping ((sending Any?) -> Void)) in
                api.getString { (result: Result<String?, Error>) in
                    switch result {
                    case .success(let res):
                        reply(res)
                    case .failure(let error):
                        reply(error)
                    }
                }
            "
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           0x0000000113931458 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
1  swift-frontend           0x000000011392f895 llvm::sys::RunSignalHandlers() + 85
2  swift-frontend           0x0000000113931abe SignalHandler(int) + 270
3  libsystem_platform.dylib 0x00007ff80ece7e1d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603370332520960
5  libsystem_c.dylib        0x00007ff80ebd1b19 abort + 126
6  libsystem_c.dylib        0x00007ff80ebd0ddc err + 0
7  swift-frontend           0x0000000113c8bf11 (anonymous namespace)::SendNonSendableImpl::emitVerbatimErrors() (.cold.63) + 33
8  swift-frontend           0x000000010d7fe942 (anonymous namespace)::SendNonSendableImpl::emitVerbatimErrors() + 18210
9  swift-frontend           0x000000010d7f6aa7 (anonymous namespace)::SendNonSendable::run() + 8199
10 swift-frontend           0x000000010d826465 swift::SILPassManager::runPassOnFunction(unsigned int, swift::SILFunction*) + 1781
11 swift-frontend           0x000000010d827650 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 1344
12 swift-frontend           0x000000010d82aa7e swift::SILPassManager::execute() + 590
13 swift-frontend           0x000000010d823db8 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 72
14 swift-frontend           0x000000010d823d31 swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const + 65
15 swift-frontend           0x000000010d880a7d swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 29
16 swift-frontend           0x000000010d843d53 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'()) + 195
17 swift-frontend           0x000000010d823fd0 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) + 64
18 swift-frontend           0x000000010d85a289 swift::runSILDiagnosticPasses(swift::SILModule&) + 185
19 swift-frontend           0x000000010cec067c swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 60
20 swift-frontend           0x000000010cc2b6d4 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*) + 868
21 swift-frontend           0x000000010cc2aacb swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 843
22 swift-frontend           0x000000010cc38e7f withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 143
23 swift-frontend           0x000000010cc2cfe9 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 985
24 swift-frontend           0x000000010cc2c530 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2784
25 swift-frontend           0x000000010c9a5012 swift::mainEntry(int, char const**) + 2658
26 dyld                     0x00007ff80e9222cd start + 1805

Second version with local build to make better stack trace:

Stack dump
Assertion failed: (ty->isLegalSILType() && "constructing SILType with type that should have been " "eliminated by SIL lowering"), function SILType, file SILType.h, line 114.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend -c -primary-file /path/to/Sources/TestCrash/main.swift -emit-dependencies-path /path/to/.build/x86_64-apple-macosx/debug/TestCrash.build/main.d -emit-reference-dependencies-path /path/to/.build/x86_64-apple-macosx/debug/TestCrash.build/main.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -I /path/to/.build/x86_64-apple-macosx/debug/Modules -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /path/to/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -entry-point-function-name TestCrash_main -enable-upcoming-feature StrictConcurrency -empty-abi-descriptor -resource-dir /path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /path/to -Xcc -fmodule-map-file=/path/to/.build/x86_64-apple-macosx/debug/MessageChannel.build/module.modulemap -Xcc -I -Xcc /path/to/Sources/MessageChannel/include -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name TestCrash -package-name test_crash_20250105 -plugin-path /path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/lib/swift/host/plugins -target-sdk-version 15.2 -target-sdk-name macosx15.2 -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 /path/to/.build/x86_64-apple-macosx/debug/TestCrash.build/main.swift.o -index-store-path /path/to/.build/x86_64-apple-macosx/debug/index/store -index-system-modules
1.	Swift version 6.2-dev (LLVM 06a77c5cc0ff511, Swift 8d7461cfecba1a6)
2.	Compiling with effective version 5.10
3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for TestCrash)
4.	While running pass #262 SILFunctionTransform "SendNonSendable" on SILFunction "@$s9TestCrash8ApiSetupC5setUp3apiyAA0C0_pSg_tFZyyp_yypnYuctcfU_".
 for expression at [/path/to/Sources/TestCrash/main.swift:22:42 - line:32:7] RangeText="{ (_: Any, reply: @escaping ((sending Any) -> Void)) in
          api.getString { (result: Result<String?, Error>) in
          switch result {
          case .success(let res):
            reply(res)
              return
          case .failure(let error):
            reply(error)
          }
        }
      "
 #0 0x0000000113a9b8a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1099e48a8)
 #1 0x0000000113a99bd5 llvm::sys::RunSignalHandlers() (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1099e2bd5)
 #2 0x0000000113a9bf06 SignalHandler(int) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1099e4f06)
 #3 0x00007ff80ece7e1d (/usr/lib/system/libsystem_platform.dylib+0x7ff800482e1d)
 #4 0x00007ff7b5e3d740
 #5 0x00007ff80ebd1b19 (/usr/lib/system/libsystem_c.dylib+0x7ff80036cb19)
 #6 0x00007ff80ebd0ddc (/usr/lib/system/libsystem_c.dylib+0x7ff80036bddc)
 #7 0x000000010aad73cd swift::SILType::SILType(swift::CanType, swift::SILValueCategory) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x100a203cd)
 #8 0x000000010aad7268 swift::SILType::SILType(swift::CanType, swift::SILValueCategory) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x100a20268)
 #9 0x000000010ab40dd1 swift::SILType::getPrimitiveObjectType(swift::CanType) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x100a89dd1)
#10 0x000000010bc6bad1 (anonymous namespace)::SentNeverSendableDiagnosticInferrer::initForSendingPartialApply(swift::FullApplySite, swift::Operand*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bb4ad1)
#11 0x000000010bc6873b (anonymous namespace)::SentNeverSendableDiagnosticInferrer::run() (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bb173b)
#12 0x000000010bc550a7 (anonymous namespace)::SendNonSendableImpl::emitVerbatimErrors() (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101b9e0a7)
#13 0x000000010bc53d19 (anonymous namespace)::SendNonSendableImpl::emitDiagnostics() (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101b9cd19)
#14 0x000000010bc53b20 (anonymous namespace)::SendNonSendable::run() (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101b9cb20)
#15 0x000000010bcb4100 swift::SILPassManager::runPassOnFunction(unsigned int, swift::SILFunction*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bfd100)
#16 0x000000010bcb5589 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bfe589)
#17 0x000000010bcba2ac swift::SILPassManager::execute() (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101c032ac)
#18 0x000000010bcb1d36 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bfad36)
#19 0x000000010bcb1b14 swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bfab14)
#20 0x000000010bd28157 std::__1::tuple<> swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101c71157)
#21 0x000000010bd2807d swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101c7107d)
#22 0x000000010bcea07e 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'()) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101c3307e)
#23 0x000000010bce9f8d swift::ExecuteSILPipelineRequest::OutputType swift::Evaluator::operator()<swift::ExecuteSILPipelineRequest, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'(), (void*)0>(swift::ExecuteSILPipelineRequest const&, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101c32f8d)
#24 0x000000010bcb1e39 swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bfae39)
#25 0x000000010bcb1e15 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101bfae15)
#26 0x000000010bd0b794 swift::runSILDiagnosticPasses(swift::SILModule&) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x101c54794)
#27 0x000000010a95cc1e performMandatorySILPasses(swift::CompilerInvocation&, swift::SILModule*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1008a5c1e)
#28 0x000000010a95ca77 swift::CompilerInstance::performSILProcessing(swift::SILModule*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1008a5a77)
#29 0x000000010a47c1f9 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*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003c51f9)
#30 0x000000010a47b994 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003c4994)
#31 0x000000010a49fbd3 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_7::operator()(swift::CompilerInstance&) const (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003e8bd3)
#32 0x000000010a49fb2d bool llvm::function_ref<bool (swift::CompilerInstance&)>::callback_fn<performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_7>(long, swift::CompilerInstance&) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003e8b2d)
#33 0x000000010a49ef71 llvm::function_ref<bool (swift::CompilerInstance&)>::operator()(swift::CompilerInstance&) const (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003e7f71)
#34 0x000000010a49df38 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003e6f38)
#35 0x000000010a495c65 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003dec65)
#36 0x000000010a47e196 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003c7196)
#37 0x000000010a47d48d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1003c648d)
#38 0x000000010a0f06f0 run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x1000396f0)
#39 0x000000010a0ef32b swift::mainEntry(int, char const**) (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x10003832b)
#40 0x000000010a0ee972 main (/path/to/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend+0x100037972)
#41 0x00007ff80e9222cd

Expected behavior

The compiler should either accept the code or reject it with a proper error message. It should not crash with an assertion failure.

Environment

$ xcrun --toolchain swift swift --version
Apple Swift version 6.2-dev (LLVM 06a77c5cc0ff511, Swift 8e9f7b657285063)
Target: x86_64-apple-macosx15.0

Additional information

No response

@bc-lee bc-lee 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 Jan 5, 2025
@xedin
Copy link
Contributor

xedin commented Jan 5, 2025

cc @gottesmm

@xedin xedin added concurrency Feature: umbrella label for concurrency language features SIL compiler The Swift compiler itself and removed triage needed This issue needs more specific labels labels Jan 5, 2025
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. compiler The Swift compiler itself concurrency Feature: umbrella label for concurrency language features crash Bug: A crash, i.e., an abnormal termination of software SIL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants