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

Assertion failure swift::ProtocolConformanceRef::subst with 6.1 in release build #79318

Closed
vsarunas opened this issue Feb 12, 2025 · 5 comments · Fixed by #80373
Closed

Assertion failure swift::ProtocolConformanceRef::subst with 6.1 in release build #79318

vsarunas opened this issue Feb 12, 2025 · 5 comments · Fixed by #80373
Assignees
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 distributed Feature → concurrency: distributed actor

Comments

@vsarunas
Copy link

Description

Preparing for Swift 6.1 adoption and experiencing a compiler crash while compiling in release mode; debug mode works fine.

Adding

-Xllvm '-sil-print-function=$s17DistributedSystemAAC0A00a5ActorB0AacDP10remoteCall2on6target10invocation8throwing9returningqd_1_qd___AC06RemoteE6TargetV17InvocationEncoderQzzqd_0_mqd_1_mtYaKAC0aC0Rd__s5ErrorRd_0_2IDQyd__0cP0Rtzr1_lFTW'

Shows:

  *** SIL module after #1232, stage IRGen Preparation, pass 1: LoadableByAddress (loadable-address)
// protocol witness for DistributedActorSystem.remoteCall<A, B, C>(on:target:invocation:throwing:returning:) in conformance DistributedSystem
sil shared [transparent] [thunk] @$s17DistributedSystemAAC0A00a5ActorB0AacDP10remoteCall2on6target10invocation8throwing9returningqd_1_qd___AC06RemoteE6TargetV17InvocationEncoderQzzqd_0_mqd_1_mtYaKAC0aC0Rd__s5ErrorRd_0_2IDQyd__0cP0Rtzr1_lFTW : $@convention(witness_method: DistributedActorSystem) @async <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : DistributedActor, τ_0_1 : Error, τ_0_0.ID == EndpointIdentifier> (@guaranteed τ_0_0, @in_guaranteed RemoteCallTarget, @inout RemoteCallEncoder, @thick τ_0_1.Type, @thick τ_0_2.Type, @in_guaranteed DistributedSystem) -> (@out τ_0_2, @error any Error) {
[%0: noescape **, write v**]
[%1: read v**.c*.v**, write v**.c*.v**, copy v**.**, destroy v**.c*.v**]
[%2: read v**, copy v**]
[%3: noescape v**, read v**, write s1.s1.v**, copy v**, destroy v**]
[%6: read v**, copy v**]
[global: read,write,copy,destroy,allocate,deinit_barrier]
// %0                                             // user: %9
// %1                                             // user: %9
// %2                                             // user: %9
// %3                                             // user: %9
// %4                                             // user: %9
// %5                                             // user: %9
// %6                                             // user: %7
bb0(%0 : $*τ_0_2, %1 : $τ_0_0, %2 : $*RemoteCallTarget, %3 : $*RemoteCallEncoder, %4 : $@thick τ_0_1.Type, %5 : $@thick τ_0_2.Type, %6 : $*DistributedSystem):
  %7 = load %6 : $*DistributedSystem              // user: %9
  // function_ref DistributedSystem.remoteCall<A, B, C>(on:target:invocation:throwing:returning:)
  %8 = function_ref @$s17DistributedSystemAAC10remoteCall2on6target10invocation8throwing9returningq0_x_0A006RemoteD6TargetVAA0jD7EncoderVzq_mq0_mtYaKAI0A5ActorRzs5ErrorR_AA12TransferableR0_AA18EndpointIdentifierV2IDRtzr1_lF : $@convention(method) @async <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : DistributedActor, τ_0_1 : Error, τ_0_2 : Transferable, τ_0_0.ID == EndpointIdentifier> (@guaranteed τ_0_0, @in_guaranteed RemoteCallTarget, @inout RemoteCallEncoder, @thick τ_0_1.Type, @thick τ_0_2.Type, @guaranteed DistributedSystem) -> (@out τ_0_2, @error any Error) // user: %9
  try_apply %8<τ_0_0, τ_0_1, τ_0_2>(%0, %1, %2, %3, %4, %5, %7) : $@convention(method) @async <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : DistributedActor, τ_0_1 : Error, τ_0_2 : Transferable, τ_0_0.ID == EndpointIdentifier> (@guaranteed τ_0_0, @in_guaranteed RemoteCallTarget, @inout RemoteCallEncoder, @thick τ_0_1.Type, @thick τ_0_2.Type, @guaranteed DistributedSystem) -> (@out τ_0_2, @error any Error), normal bb1, error bb2 // id: %9

bb1(%10 : $()):                                   // Preds: bb0
  %11 = tuple ()                                  // user: %12
  return %11 : $()                                // id: %12

// %13                                            // user: %14
bb2(%13 : $any Error):                            // Preds: bb0
  throw %13 : $any Error                          // id: %14
} // end sil function '$s17DistributedSystemAAC0A00a5ActorB0AacDP10remoteCall2on6target10invocation8throwing9returningqd_1_qd___AC06RemoteE6TargetV17InvocationEncoderQzzqd_0_mqd_1_mtYaKAC0aC0Rd__s5ErrorRd_0_2IDQyd__0cP0Rtzr1_lFTW'

Assertion failed: (!isInvalid()), function getRequirement, file ProtocolConformanceRef.cpp, line 53.

Reproduction

git clone https://github.com/ordo-one/package-distributed-system.git && cd package-distributed-system
swift build -c release

Stack dump

Assertion failed: (!isInvalid()), function getRequirement, file ProtocolConformanceRef.cpp, line 53.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/ChannelCompression.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/ChannelCounters.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/ChannelHandler.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/ChannelHandshake.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DecodeError.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DiscoveryManager.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DistributedSystem.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DistributedSystemErrors.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DistributedSystemServer.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/EndpointIdentifier.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/Endpointable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/InvocationEnvelope.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/NetworkAddress.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/RemoteCallDecoder.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/RemoteCallEncoder.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/RemoteCallResultHandler.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/SyncCallManager.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/Array+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/Bool+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/Dictionary+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/Double+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/Integer+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/Optional+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/TransferableConformance/String+Transferable.swift /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/ULEB128.swift -supplementary-output-file-map /var/folders/zx/1np75sd15ygcssjxtfnq30xc0000gn/T/TemporaryDirectory.wWFNne/supplementaryOutputs-1 -target arm64-apple-macosx14.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -I /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/Modules -I /opt/homebrew/opt/lz4/include -I /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/lib/swift/macosx/testing -I /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -F /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -enable-experimental-feature AccessLevelOnImport -enable-upcoming-feature BareSlashRegexLiterals -enable-upcoming-feature ConciseMagicFile -enable-upcoming-feature DeprecateApplicationMain -enable-upcoming-feature DisableOutwardActorInference -enable-upcoming-feature ForwardTrailingClosures -enable-upcoming-feature StrictConcurrency -empty-abi-descriptor -plugin-path /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/lib/swift/host/plugins/testing -resource-dir /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/lib/swift -file-compilation-dir /Users/sarunas/GitHub/ordo-one/package-distributed-system -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/CNIOLLHTTP.build/module.modulemap -Xcc -I -Xcc /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-nio/Sources/CNIOLLHTTP/include -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/CNIOAtomics.build/module.modulemap -Xcc -I -Xcc /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-atomics/Sources/_AtomicsShims/include/module.modulemap -Xcc -I -Xcc /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-atomics/Sources/_AtomicsShims/include -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-nio/Sources/CNIOWindows/include/module.modulemap -Xcc -I -Xcc /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-nio/Sources/CNIOWindows/include -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/CNIOLinux.build/module.modulemap -Xcc -I -Xcc /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/CNIODarwin.build/module.modulemap -Xcc -I -Xcc /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -fmodule-map-file=/Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/checkouts/package-system-libs/Sources/lz4/module.modulemap -Xcc -isysroot -Xcc /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -Xcc -F -Xcc /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -F -Xcc /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -Xcc -fPIC -Xcc -g -module-name DistributedSystem -package-name package_distributed_system -in-process-plugin-server-path /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/sarunas/Library/Developer/Toolchains/swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10-a.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.2 -target-sdk-name macosx15.2 -external-plugin-path /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -enable-default-cmo -parse-as-library -num-threads 10 -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/ChannelCompression.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/ChannelCounters.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/ChannelHandler.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/ChannelHandshake.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/DecodeError.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/DiscoveryManager.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/DistributedSystem.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/DistributedSystemErrors.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/DistributedSystemServer.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/EndpointIdentifier.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Endpointable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/InvocationEnvelope.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/NetworkAddress.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/RemoteCallDecoder.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/RemoteCallEncoder.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/RemoteCallResultHandler.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/SyncCallManager.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Array+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Bool+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Dictionary+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Double+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Integer+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/Optional+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/String+Transferable.swift.o -o /Users/sarunas/GitHub/ordo-one/package-distributed-system/.build/arm64-apple-macosx/release/DistributedSystem.build/ULEB128.swift.o
1.	Apple Swift version 6.1-dev (LLVM 36d7ebc48349af6, Swift c710b6d3de6a71b)
2.	Compiling with effective version 5.10
3.	While emitting IR SIL function "@$s17DistributedSystemAAC0A00a5ActorB0AacDP10remoteCall2on6target10invocation8throwing9returningqd_1_qd___AC06RemoteE6TargetV17InvocationEncoderQzzqd_0_mqd_1_mtYaKAC0aC0Rd__s5ErrorRd_0_2IDQyd__0cP0Rtzr1_lFTW".
 for 'remoteCall(on:target:invocation:throwing:returning:)' (at /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DistributedSystem.swift:1080: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           0x000000010a73f290 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x000000010a73d974 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010a73f8ec SignalHandler(int) + 304
3  libsystem_platform.dylib 0x0000000195ae6de4 _sigtramp + 56
4  libsystem_pthread.dylib  0x0000000195aaff70 pthread_kill + 288
5  libsystem_c.dylib        0x00000001959bc908 abort + 128
6  libsystem_c.dylib        0x00000001959bbc1c err + 0
7  swift-frontend           0x000000010ad4ca7c swift::ProtocolConformanceRef::subst(swift::Type, swift::InFlightSubstitution&) const (.cold.1) + 0
8  swift-frontend           0x000000010653fd80 swift::ProtocolConformanceRef::getRequirement() const + 244
9  swift-frontend           0x000000010511a3d4 swift::irgen::emitWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanType, llvm::Value**, swift::ProtocolConformanceRef) + 68
10 swift-frontend           0x000000010511b0c0 swift::irgen::emitGenericRequirementFromSubstitutions(swift::irgen::IRGenFunction&, swift::GenericRequirement, swift::MetadataState, swift::SubstitutionMap, bool) + 320
11 swift-frontend           0x00000001051213c8 void llvm::function_ref<void (swift::GenericRequirement)>::callback_fn<(anonymous namespace)::EmitPolymorphicArguments::emit(swift::SubstitutionMap, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&)::$_18>(long, swift::GenericRequirement) + 64
12 swift-frontend           0x0000000105121884 void llvm::function_ref<void (swift::GenericRequirement)>::callback_fn<(anonymous namespace)::PolymorphicConvention::enumerateUnfulfilledRequirements(llvm::function_ref<void (swift::GenericRequirement)> const&)::$_9>(long, swift::GenericRequirement) + 180
13 swift-frontend           0x0000000105112828 swift::irgen::enumerateGenericSignatureRequirements(swift::CanGenericSignature, llvm::function_ref<void (swift::GenericRequirement)> const&) + 280
14 swift-frontend           0x000000010511a78c swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::SubstitutionMap, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&) + 272
15 swift-frontend           0x00000001051e37c4 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2828
16 swift-frontend           0x00000001051c3774 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 2236
17 swift-frontend           0x00000001051c1d50 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 8800
18 swift-frontend           0x00000001051bf550 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1800
19 swift-frontend           0x00000001050559d0 swift::irgen::IRGenerator::emitLazyDefinitions() + 1992
20 swift-frontend           0x0000000105171a78 swift::performIRGeneration(swift::ModuleDecl*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::GlobalVariable**) + 2456
21 swift-frontend           0x0000000104c4795c 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>>>) + 272
22 swift-frontend           0x0000000104c446e0 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*) + 1376
23 swift-frontend           0x0000000104c43da0 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1228
24 swift-frontend           0x0000000104c4f8f4 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
25 swift-frontend           0x0000000104c4583c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
26 swift-frontend           0x0000000104c45058 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2200
27 swift-frontend           0x0000000104a1c0d8 swift::mainEntry(int, char const**) + 3100
28 dyld                     0x0000000195730274 start + 2840

Expected behavior

Succesful compilation.

Environment

swift-6.1-DEVELOPMENT-SNAPSHOT-2025-02-10:

swiftc --version
Apple Swift version 6.1-dev (LLVM 36d7ebc48349af6, Swift c710b6d3de6a71b)
Target: arm64-apple-macosx15.0

Also reproduces on swift-DEVELOPMENT-SNAPSHOT-2025-02-04:

swiftc --version
Apple Swift version 6.2-dev (LLVM a5ea48e1c09da51, Swift c14561fba3c057a)
Target: arm64-apple-macosx15.0

Additional information

No response

@vsarunas vsarunas 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 Feb 12, 2025
@vsarunas
Copy link
Author

#70834 looks similar, but unsure it is exactly the same.

@ktoso
Copy link
Contributor

ktoso commented Mar 18, 2025

rdar://146101172

@vsarunas
Copy link
Author

Same stack with Xcode 16.3 Beta 3:

DEVELOPER_DIR=/Applications/Xcode-16.3.0-Beta.3.app/Contents/Developer swift build -c release
Building for production...
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-Beta.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend
[...]
1.	Apple Swift version 6.1 (swiftlang-6.1.0.110.5 clang-1700.0.13.3)
2.	Compiling with the current language version
3.	While emitting IR SIL function "@$s17DistributedSystemAAC0A00a5ActorB0AacDP10remoteCall2on6target10invocation8throwing9returningqd_1_qd___AC06RemoteE6TargetV17InvocationEncoderQzzqd_0_mqd_1_mtYaKAC0aC0Rd__s5ErrorRd_0_2IDQyd__0cP0Rtzr1_lFTW".
 for 'remoteCall(on:target:invocation:throwing:returning:)' (at /Users/sarunas/GitHub/ordo-one/package-distributed-system/Sources/DistributedSystem/DistributedSystem.swift:1062: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           0x000000010abdac28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x000000010abd8a60 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010abdb264 SignalHandler(int) + 360
3  libsystem_platform.dylib 0x000000019baaade4 _sigtramp + 56
4  swift-frontend           0x0000000104fd2780 swift::irgen::emitWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanType, llvm::Value**, swift::ProtocolConformanceRef) + 276
5  swift-frontend           0x0000000104fd2780 swift::irgen::emitWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanType, llvm::Value**, swift::ProtocolConformanceRef) + 276
6  swift-frontend           0x0000000104fd31cc swift::irgen::emitGenericRequirementFromSubstitutions(swift::irgen::IRGenFunction&, swift::GenericRequirement, swift::MetadataState, swift::SubstitutionMap, bool) + 240
7  swift-frontend           0x0000000104fda57c void llvm::function_ref<void (swift::GenericRequirement)>::callback_fn<(anonymous namespace)::EmitPolymorphicArguments::emit(swift::SubstitutionMap, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&)::$_0>(long, swift::GenericRequirement) + 64
8  swift-frontend           0x0000000104fdaca4 void llvm::function_ref<void (swift::GenericRequirement)>::callback_fn<(anonymous namespace)::PolymorphicConvention::enumerateUnfulfilledRequirements(llvm::function_ref<void (swift::GenericRequirement)> const&)::$_0>(long, swift::GenericRequirement) + 212
9  swift-frontend           0x0000000104fc8bb8 swift::irgen::enumerateGenericSignatureRequirements(swift::CanGenericSignature, llvm::function_ref<void (swift::GenericRequirement)> const&) + 220
10 swift-frontend           0x0000000104fd2988 swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::SubstitutionMap, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&) + 292

@ktoso
Copy link
Contributor

ktoso commented Mar 18, 2025

Related forums thread: https://forums.swift.org/t/proper-way-to-escalate-swift-6-1-crash-blockers/78620

Copying my response

So the good news is that I'm reproducing the crash readily, so thank you for the ping on this.

The mixed good/bad news is that it also reproduces on current main / 6.2 which means this has been around since 6.1 somehow. It is not just about some aggressive assertion; since removing the assertion just gets us a real crash elsewhere.

I also confirm it only fails in release mode AFAICS, and not in debug mode...

Thanks for the ping here, I'll see what I can find out.

@ktoso
Copy link
Contributor

ktoso commented Mar 26, 2025

Fix incoming soon: #80109

xedin added a commit to xedin/swift that referenced this issue Mar 28, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
xedin added a commit to xedin/swift that referenced this issue Mar 28, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
(cherry picked from commit 0415b40)
xedin added a commit to xedin/swift that referenced this issue Mar 28, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
(cherry picked from commit 0415b40)
xedin added a commit to xedin/swift that referenced this issue Mar 28, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
(cherry picked from commit 0415b40)
xedin added a commit to xedin/swift that referenced this issue Mar 28, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
xedin added a commit to xedin/swift that referenced this issue Mar 28, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
(cherry picked from commit 0415b40)
xedin added a commit to xedin/swift that referenced this issue Mar 30, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
(cherry picked from commit 0415b40)
xedin added a commit to xedin/swift that referenced this issue Mar 30, 2025
…s requirements

This is a narrow fix, we are going to work on fixing this properly
and allowing both devirtualization and specialization for distributed
requirement witnesses.

Anything that uses an ad-hoc serialization requirement scheme cannot
be devirtualized because that would result in loss of ad-hoc conformance
in new substitution map.

Resolves: swiftlang#79318
Resolves: rdar://146101172
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 distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants