Xcode 11.2.1 swift_getWitnessTable runtime crash (includes minimal test case)

Using Xcode 11.2.1 with a project that depends on a minimal static library built through SwiftPM, I've got a runtime crash when invoking a generic function when built under a release config with optimizations on (Debug builds are fine). This is a default xcodeproject, I haven't customized any build settings.

I've got a relatively minimal test case at https://github.com/MichaelShaw/UITestMinimal

On launch it crahes on swift_getWitnessTable producing:

#2	0x00000001c3fe8a74 in abort ()
#3	0x00000001d1c3d2a4 in swift_runtime_unreachable(char const*) ()
#4	0x00000001d1c3ee34 in swift_getWitnessTable ()
#5	0x00000001021b09b0 in lazy protocol witness table accessor for type Interaction<Int> and     conformance Interaction<A> [inlined] ()
#6	0x00000001021b096c in specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) at /Users/michael/workspace/UITestMinimal/UITester/AppDelegate.swift:17
#7	0x00000001021b030c in AppDelegate.application(_:didFinishLaunchingWithOptions:) [inlined] ()

I've reduced this from a more complex example.

Fumbling around with LLDB in my more complex example (that I can't easily share), I was hitting the unreachable at https://github.com/apple/swift/blob/master/stdlib/public/runtime/Metadata.cpp#L4537

It appeared that the mangledName where it expects a symbolic reference in a StringRef of size 5, preceding the crash it was only receiving a StringRef of length 3, leading to hitting the unreachable block.

Does setting DEAD_CODE_STRIPPING = NO work around the issue for you? There's a chance this is the same as GRDB: Crash when saving records with Xcode 11.2 due to SR-11643 .


DEAD_CODE_STRIPPING = NO solves both my trivial test case as well as the more complex case. Thanks for the work around!

Terms of Service

Privacy Policy

Cookie Policy