-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Description
Description
The Swift compiler crashes with signal 5 in the MandatoryPerformanceOptimizations pass when compiling code that uses typed throws (throws(E)) on protocol witness conformances targeting Embedded Swift (wasm32).
Reproduction
Minimal reproducer: https://github.com/coenttb/swift-embedded-typed-throws-crash
Environment:
- Swift 6.2.3 (swift-6.2.3-RELEASE)
- Target: wasm32-unknown-wasip1 (Embedded Swift)
- SDK: swift-6.2.3-RELEASE_wasm-embedded
Steps to reproduce:
git clone https://github.com/coenttb/swift-embedded-typed-throws-crash.git
cd swift-embedded-typed-throws-crash
swift build --swift-sdk swift-6.2.3-RELEASE_wasm-embeddedExpected behavior
The code should compile successfully.
Actual behavior
Compiler crashes with signal 5:
error: emit-module command failed due to signal 5 (use -v to see invocation)
error: compile command failed due to signal 5 (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: ...swift-frontend -frontend -c ...
1. Apple Swift version 6.2.3 (swift-6.2.3-RELEASE)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for TypedThrowsCrash)
4. While running pass #1491 SILModuleTransform "MandatoryPerformanceOptimizations".
Stack trace
#0 0x0000000105e16bd8 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1059eabd8)
#1 0x0000000105e15304 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1059e9304)
#2 0x0000000105e17220 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1059eb220)
#3 0x000000018ac6e744 (/usr/lib/system/libsystem_platform.dylib+0x1804d6744)
#4 0x000000010057ac24 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x10014ec24)
#5 0x000000010058304c (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x10015704c)
#6 0x00000001005805f8 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1001545f8)
#7 0x000000010105cd04 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c30d04)
#8 0x000000010105f124 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c33124)
#9 0x0000000101059b2c (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c2db2c)
#10 0x0000000101059aac (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c2daac)
#11 0x000000010107f2ec (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c532ec)
#12 0x0000000101060cf8 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c34cf8)
#13 0x0000000101059d1c (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c2dd1c)
#14 0x00000001010622cc (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100c362cc)
#15 0x00000001009051bc (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1004d91bc)
#16 0x00000001006c3f4c (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100297f4c)
#17 0x00000001006c3904 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100297904)
#18 0x00000001006cfd78 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1002a3d78)
#19 0x00000001006c53a4 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1002993a4)
#20 0x00000001006c4b60 (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x100298b60)
#21 0x00000001004621dc (/Users/coen/Library/Developer/Toolchains/swift-6.2.3-RELEASE.xctoolchain/usr/bin/swift-frontend+0x1000361dc)
Notes
The crash appears to require the combination of:
- Embedded Swift target (wasm32)
- Lifetimes experimental feature enabled
- Protocol with
~Copyableconstraint - Typed throws (
throws(E)) on protocol witness methods Span<UInt8>property with@_lifetimeannotationArrayconforming to the protocol
The same code compiles successfully for non-Embedded targets.
Metadata
Metadata
Assignees
Labels
No labels