Open flockoffiles opened 8 months ago
Same here with a similar Either type. Both optimizations for Size & Speed trigger the compiler bug, as opposed to no optimization which doesn't trigger the bug.
Crashing in Mem2Reg CC: @meg-gupta @nate-chandler
Thanks for the report. I'll take a look.
This was fixed by https://github.com/apple/swift/pull/71521 on main
and release/6.0
.
@nate-chandler thank you. I wasn’t able to reproduce this with the latest toolchain.
Workarounds include:
(1) Add the @_optimize(none)
annotation to the affected function:
$ xcrun swift-demangle '$s13TestFramework8ResponseVAAytRszlE8metadataACyytGAA8MetadataVSg_tcfC'
$s13TestFramework8ResponseVAAytRszlE8metadataACyytGAA8MetadataVSg_tcfC ---> (extension in TestFramework):TestFramework.Response<A where A == ()>.init(metadata: TestFramework.Metadata?) -> TestFramework.Response<()>
i.e.
extension Response where WrappedType == Void {
@_optimize(none)
public init(metadata: Metadata? = nil) {
(2) Disable the pass with the bug project-wide:
-Xllvm -sil-disable-pass=mem2reg
In an Xcode project, add those two flags to Other Swift Flags
.
Description
The following simple code fails to compile when built for Release in Xcode 15.3 (see Reproduction) (Please note that I also created the Apple feedback FB13679649 for this problem.)
I am attaching an example project that demonstrates the crash. EmptyType.zip
I am compiling for iOS Simulator in Release configuration.
NOTE: The problem does NOT occur when building for Debug configuration.
Reproduction
Stack dump
Expected behavior
I did not expect the crash. This code was compiling normally by previous versions of the compiler.
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Additional information
No response