-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaretriage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
When using is to check protocol conformance of a type that has global-actor-isolated conformance whose actor type is declared final, the program crashes at runtime.
This also occurs when using as to cast a type.
Reproduction
@globalActor
final actor FooActor { // IMPORTANT: **final** actor
static let shared = FooActor()
}
protocol P {}
struct Foo: @FooActor P {}
func checkConformance() {
let foo = Foo()
let _ = foo is P // 💥 Runtime crash: EXC_BAD_ACCESS (code=1, address=0x0)
}
checkConformance()Stack dump
Stack dump:
0. Program arguments: /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -interpret IsolatedConformanceChecking.swift -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -color-diagnostics -Xcc -fcolor-diagnostics -new-driver-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -no-auto-bridging-header-chaining -module-name IsolatedConformanceChecking -disable-clang-spi -target-sdk-version 26.0 -target-sdk-name macosx26.0 -external-plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -in-process-plugin-server-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins
1. Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
2. Compiling with effective version 5.10
3. While running user code "IsolatedConformanceChecking.swift"
#0 0x0000000107519bcc (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1066f9bcc)
#1 0x000000010751755c (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1066f755c)
#2 0x000000010751a1f8 (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1066fa1f8)
#3 0x000000019918e744 (/usr/lib/system/libsystem_platform.dylib+0x1804d6744)
#4 0x00000001ac2f5218 (/usr/lib/swift/libswiftCore.dylib+0x19363d218)
#5 0x00000001ac2ed174 (/usr/lib/swift/libswiftCore.dylib+0x193635174)
#6 0x00000001ac2ea668 (/usr/lib/swift/libswiftCore.dylib+0x193632668)
#7 0x0000000291845c98 (/usr/lib/swift/libswift_Concurrency.dylib+0x278b8dc98)
#8 0x000000010b88440c
#9 0x0000000291847be4 (/usr/lib/swift/libswift_Concurrency.dylib+0x278b8fbe4)
#10 0x00000001ac3269b8 (/usr/lib/swift/libswiftCore.dylib+0x19366e9b8)
#11 0x00000001ac2b90b0 (/usr/lib/swift/libswiftCore.dylib+0x1936010b0)
#12 0x00000001ac2c169c (/usr/lib/swift/libswiftCore.dylib+0x19360969c)
#13 0x00000001ac2bf150 (/usr/lib/swift/libswiftCore.dylib+0x193607150)
#14 0x00000001ac2beccc (/usr/lib/swift/libswiftCore.dylib+0x193606ccc)
#15 0x000000010b884268
#16 0x000000010b8840ac
#17 0x000000029187efd0 (/usr/lib/swift/libswift_Concurrency.dylib+0x278bc6fd0)
#18 0x00000002918803c4 (/usr/lib/swift/libswift_Concurrency.dylib+0x278bc83c4)
#19 0x000000010b884074
#20 0x00000001012bedb8 (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x10049edb8)
#21 0x00000001011d14d0 (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1003b14d0)
#22 0x00000001011de9c4 (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1003be9c4)
#23 0x0000000101158e80 (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x100338e80)
#24 0x00000001011546cc (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1003346cc)
#25 0x0000000101153dbc (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x100333dbc)
#26 0x00000001011576dc (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1003376dc)
#27 0x000000010115568c (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x10033568c)
#28 0x00000001010d6c6c (/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend+0x1002b6c6c)
#29 0x0000000198dc5d54
zsh: segmentation fault swift IsolatedConformanceChecking.swift
Expected behavior
The program should not crash at runtime.
foo is P should be evaluated as:
trueinside theFooActor-isolated contextfalseoutside theFooActor-isolated context
Environment
swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx26.0
Additional information
Non-crashing samples
FooActor is not final
@globalActor
actor FooActor { // IMPORTANT: **non-final** actor
static let shared = FooActor()
}
protocol P {}
struct Foo: @FooActor P {}
func checkConformance() {
let foo = Foo()
let _ = foo is P // ✅ No crash
}
checkConformance()Conformance checking on FooActor-isolated context
@globalActor
final actor FooActor { // IMPORTANT: **final** actor
static let shared = FooActor()
}
protocol P {}
struct Foo: @FooActor P {}
@FooActor // IMPORTANT: isolate to FooActor
func checkConformance() {
let foo = Foo()
let _ = foo is P // ✅ No crash
}
await checkConformance()Related proposal
https://github.com/swiftlang/swift-evolution/blob/main/proposals/0470-isolated-conformances.md
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaretriage neededThis issue needs more specific labelsThis issue needs more specific labels