-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Description
% swiftc -swift-version 6 -enable-experimental-feature StrictConcurrency swift-crash-repro.swift
error: compile command failed due to signal 6 (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.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file swift-crash-repro.swift -target arm64-apple-macosx16.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -color-diagnostics -swift-version 6 -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -enable-experimental-feature StrictConcurrency -empty-abi-descriptor -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -module-name main -disable-clang-spi -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 -in-process-plugin-server-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/0q/4pg286lx39gbbv2pp61bqsbh0000gn/T/TemporaryDirectory.Djp7z1/swift-crash-repro-1.o
-
Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
-
Compiling with the current language version
-
While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for main)
-
While running pass Fix typo and grammar in docs/DebuggingTheCompiler.rst #130 SILFunctionTransform "SendNonSendable" on SILFunction "@$s4main9TestActorC19performCFHostLookupSSSgyYaFyScCyAEs5NeverOGXEfU_".
for expression at [swift-crash-repro.swift:16:39 - line:58:9] RangeText="{ continuation in
// Create CFHost
let address = "127.0.0.1".data(using: .utf8)!
let cfHost = CFHostCreateWithAddress(
kCFAllocatorDefault,
address as CFData
).takeRetainedValue()// Set up callback context var context = CFHostClientContext() context.version = 0 context.info = nil // This line seems related to the crash context.retain = nil context.release = nil context.copyDescription = nil // Callback for async resolution let callback: CFHostClientCallBack = { host, typeInfo, error, info in // Access continuation from callback causes issues var resolved: DarwinBoolean = false if let names = CFHostGetNames(host, &resolved)?.takeUnretainedValue() as? [String], resolved.boolValue, let firstHost = names.first { continuation.resume(returning: firstHost) } else { continuation.resume(returning: nil) } } // Set client callback CFHostSetClient(cfHost, callback, &context) // Schedule with run loop CFHostScheduleWithRunLoop( cfHost, CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue ) // Start resolution var error = CFStreamError() _ = CFHostStartInfoResolution(cfHost, .names, &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 0x000000010a7eee24 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x000000010a7ecc5c llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x000000010a7ef460 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x0000000187030704 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000187026848 pthread_kill + 296
5 libsystem_c.dylib 0x0000000186f2c808 abort + 124
6 swift-frontend 0x00000001056e6fe0 swift::Partition::assignElement(swift::PartitionPrimitives::Element, swift::PartitionPrimitives::Element, bool) + 96
7 swift-frontend 0x000000010524b0b8 swift::RegionAnalysisFunctionInfo::runDataflow() + 8836
8 swift-frontend 0x000000010524e058 swift::RegionAnalysis::newFunctionAnalysis(swift::SILFunction*) + 4188
9 swift-frontend 0x00000001054a3564 (anonymous namespace)::SendNonSendable::run() + 308
10 swift-frontend 0x00000001054dfa9c swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 3336
11 swift-frontend 0x00000001054dbee0 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 12100
12 swift-frontend 0x0000000105516edc swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 52
13 swift-frontend 0x00000001054fa96c swift::ExecuteSILPipelineRequest::OutputType swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatalswift::ExecuteSILPipelineRequest(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()>(swift::ExecuteSILPipelineRequest const&, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatalswift::ExecuteSILPipelineRequest(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()) + 412
14 swift-frontend 0x00000001054fdc6c swift::runSILDiagnosticPasses(swift::SILModule&) + 416
15 swift-frontend 0x0000000104a008b0 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 656
16 swift-frontend 0x0000000104640d90 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1360
17 swift-frontend 0x00000001046400a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
18 swift-frontend 0x0000000104643654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
19 swift-frontend 0x0000000104641fd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
20 swift-frontend 0x00000001045c60bc swift::mainEntry(int, char const**) + 5428
21 dyld 0x0000000186c69924 start + 6400
(base) dew@Grunthor ftr-swift % swiftc -v -swift-version 6 -enable-experimental-feature StrictConcurrency swift-crash-repro.swift
Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx16.0
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file swift-crash-repro.swift -target arm64-apple-macosx16.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -color-diagnostics -swift-version 6 -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -enable-experimental-feature StrictConcurrency -empty-abi-descriptor -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -module-name main -disable-clang-spi -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' -in-process-plugin-server-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/0q/4pg286lx39gbbv2pp61bqsbh0000gn/T/TemporaryDirectory.5cWDUw/swift-crash-repro-1.o
error: compile command failed due to signal 6 (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.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file swift-crash-repro.swift -target arm64-apple-macosx16.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -color-diagnostics -swift-version 6 -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -enable-experimental-feature StrictConcurrency -empty-abi-descriptor -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -module-name main -disable-clang-spi -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 -in-process-plugin-server-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/0q/4pg286lx39gbbv2pp61bqsbh0000gn/T/TemporaryDirectory.5cWDUw/swift-crash-repro-1.o
-
Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
-
Compiling with the current language version
-
While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for main)
-
While running pass Fix typo and grammar in docs/DebuggingTheCompiler.rst #130 SILFunctionTransform "SendNonSendable" on SILFunction "@$s4main9TestActorC19performCFHostLookupSSSgyYaFyScCyAEs5NeverOGXEfU_".
for expression at [swift-crash-repro.swift:16:39 - line:58:9] RangeText="{ continuation in
// Create CFHost
let address = "127.0.0.1".data(using: .utf8)!
let cfHost = CFHostCreateWithAddress(
kCFAllocatorDefault,
address as CFData
).takeRetainedValue()// Set up callback context var context = CFHostClientContext() context.version = 0 context.info = nil // This line seems related to the crash context.retain = nil context.release = nil context.copyDescription = nil // Callback for async resolution let callback: CFHostClientCallBack = { host, typeInfo, error, info in // Access continuation from callback causes issues var resolved: DarwinBoolean = false if let names = CFHostGetNames(host, &resolved)?.takeUnretainedValue() as? [String], resolved.boolValue, let firstHost = names.first { continuation.resume(returning: firstHost) } else { continuation.resume(returning: nil) } } // Set client callback CFHostSetClient(cfHost, callback, &context) // Schedule with run loop CFHostScheduleWithRunLoop( cfHost, CFRunLoopGetCurrent(), CFRunLoopMode.defaultMode.rawValue ) // Start resolution var error = CFStreamError() _ = CFHostStartInfoResolution(cfHost, .names, &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):
Reproduction
// Swift 6.1 Compiler Crash Reproduction
// This causes a compiler crash with strict concurrency in Swift 6.1
//
// Crash signature:
// swift-frontend crashed with signal(6):
// swift::Partition::assignElement in SendNonSendable pass
//
// To reproduce:
// swiftc -swift-version 6 -enable-experimental-feature StrictConcurrency swift-crash-repro.swift
import Foundation
import CoreFoundation
actor TestActor {
func performCFHostLookup() async -> String? {
await withCheckedContinuation { continuation in
// Create CFHost
let address = "127.0.0.1".data(using: .utf8)!
let cfHost = CFHostCreateWithAddress(
kCFAllocatorDefault,
address as CFData
).takeRetainedValue()
// Set up callback context
var context = CFHostClientContext()
context.version = 0
context.info = nil // This line seems related to the crash
context.retain = nil
context.release = nil
context.copyDescription = nil
// Callback for async resolution
let callback: CFHostClientCallBack = { host, typeInfo, error, info in
// Access continuation from callback causes issues
var resolved: DarwinBoolean = false
if let names = CFHostGetNames(host, &resolved)?.takeUnretainedValue() as? [String],
resolved.boolValue,
let firstHost = names.first {
continuation.resume(returning: firstHost)
} else {
continuation.resume(returning: nil)
}
}
// Set client callback
CFHostSetClient(cfHost, callback, &context)
// Schedule with run loop
CFHostScheduleWithRunLoop(
cfHost,
CFRunLoopGetCurrent(),
CFRunLoopMode.defaultMode.rawValue
)
// Start resolution
var error = CFStreamError()
_ = CFHostStartInfoResolution(cfHost, .names, &error)
}
}
}
// The crash occurs during compilation, specifically in the SendNonSendable analysis pass.
// The issue appears to be related to capturing the continuation in the CFHost callback
// within an actor-isolated context with Swift 6's strict concurrency checkingStack dump
0 swift-frontend 0x000000010ab8ee24 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x000000010ab8cc5c llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x000000010ab8f460 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x0000000187030704 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000187026848 pthread_kill + 296
5 libsystem_c.dylib 0x0000000186f2c808 abort + 124
6 swift-frontend 0x0000000105a86fe0 swift::Partition::assignElement(swift::PartitionPrimitives::Element, swift::PartitionPrimitives::Element, bool) + 96
7 swift-frontend 0x00000001055eb0b8 swift::RegionAnalysisFunctionInfo::runDataflow() + 8836
8 swift-frontend 0x00000001055ee058 swift::RegionAnalysis::newFunctionAnalysis(swift::SILFunction*) + 4188
9 swift-frontend 0x0000000105843564 (anonymous namespace)::SendNonSendable::run() + 308
10 swift-frontend 0x000000010587fa9c swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 3336
11 swift-frontend 0x000000010587bee0 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 12100
12 swift-frontend 0x00000001058b6edc swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 52
13 swift-frontend 0x000000010589a96c 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
14 swift-frontend 0x000000010589dc6c swift::runSILDiagnosticPasses(swift::SILModule&) + 416
15 swift-frontend 0x0000000104da08b0 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 656
16 swift-frontend 0x00000001049e0d90 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
17 swift-frontend 0x00000001049e00a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
18 swift-frontend 0x00000001049e3654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
19 swift-frontend 0x00000001049e1fd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
20 swift-frontend 0x00000001049660bc swift::mainEntry(int, char const**) + 5428
21 dyld 0x0000000186c69924 start + 6400
Expected behavior
Compiles
Environment
% swiftc -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-macosx16.0
Additional information
No response