-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
UnmanagedArea → standard library: The `Unmanaged` typeArea → standard library: The `Unmanaged` typeassociatedtypeFeature → declarations → protocol: `associatedtype` declarationsFeature → declarations → protocol: `associatedtype` declarationsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.conformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancescrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaredeclarationsFeature: declarationsFeature: declarationsmultiple modulesFlag: An issue whose reproduction requires multiple modulesFlag: An issue whose reproduction requires multiple modulesprotocolFeature → type declarations: Protocol declarationsFeature → type declarations: Protocol declarationsruntimeThe Swift RuntimeThe Swift Runtimestandard libraryArea: Standard library umbrellaArea: Standard library umbrellaswift 5.9
Description
Description
Runtime crash during invoking protocol (with associated type) method. The actual instance which conforms to the protocol is instantiated from dynamically loaded library. Happens in release mode only, but not in debug or debug + address sanitiser enabled. In another use case crashes in both release and debug modes.
Detailed test description cab be found here.
Example of stack trace:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [84582]
Thread 1 Crashed:
0 libswiftCore.dylib 0x18fc8289c swift::SubstGenericParametersFromMetadata::SubstGenericParametersFromMetadata(swift::TargetMetadata<swift::InProcess> const*) + 28
1 libswiftCore.dylib 0x18fc7ee58 swift_getAssociatedTypeWitnessSlowImpl(swift::MetadataRequest, swift::TargetWitnessTable<swift::InProcess>*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*) + 388
2 libswiftCore.dylib 0x18fc7d760 swift_getAssociatedTypeWitness + 92
3 Exec 0x104cbbfcc AnyLoading.instantiate<A>(plugin:ofType:) + 1204 (AnyLoading.swift:36)
4 Exec 0x104cbc674 AnyLoading.run() + 356 (AnyLoading.swift:49)
5 Exec 0x104cc5069 ExecMain.run() + 1 (Exec.swift:21)
6 Exec 0x104cc5f59 protocol witness for AsyncParsableCommand.run() in conformance ExecMain + 1
7 Exec 0x104c21931 static AsyncParsableCommand.main() + 1 (AsyncParsableCommand.swift:37)
8 Exec 0x104cc55a5 static ExecMain.$main() + 1
9 Exec 0x104cc6209 async_MainTQ0_ + 1
10 Exec 0x104cc6351 thunk for @escaping @convention(thin) @async () -> () + 1
11 Exec 0x104cc645d partial apply for thunk for @escaping @convention(thin) @async () -> () + 1
12 libswift_Concurrency.dylib 0x20d8ae215 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1
Steps to reproduce
There is a small project with scenario which reproduces the problem. Detailed description is how to run a test available here
Attaching ziped version for convenience.
Expected behavior
No crash in any of described scenarios.
Environment
$ swift --version
[plugin-creation-static.zip](https://github.com/apple/swift/files/11454117/plugin-creation-static.zip)
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
$ xcodebuild -version
Xcode 14.3
Build version 14E222b
MacOS 13.3.1
Metadata
Metadata
Assignees
Labels
UnmanagedArea → standard library: The `Unmanaged` typeArea → standard library: The `Unmanaged` typeassociatedtypeFeature → declarations → protocol: `associatedtype` declarationsFeature → declarations → protocol: `associatedtype` declarationsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.conformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancescrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaredeclarationsFeature: declarationsFeature: declarationsmultiple modulesFlag: An issue whose reproduction requires multiple modulesFlag: An issue whose reproduction requires multiple modulesprotocolFeature → type declarations: Protocol declarationsFeature → type declarations: Protocol declarationsruntimeThe Swift RuntimeThe Swift Runtimestandard libraryArea: Standard library umbrellaArea: Standard library umbrellaswift 5.9