[SR-12180] Crash in app runtime due to Swift compiler optimization -O (Optimize for speed) #54605
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
optimized only
Flag: An issue whose reproduction requires optimized compilation
Environment
Apple Swift version 5.1 (swiftlang-1100.0.270.13)
Additional Detail from JIRA
md5: 0edb6e6fee44600a3b53619a01df402a
Issue Description:
On production AppStore build we did face a 100% reproducible deterministic app crash which I was able reduce to be caused by following code. This happens only with `-O (Optimize for speed)`, `-Onone` is unaffected.
This happens both on X86-64 and ARM so clearly it's a Swift compiler issue.
We found four possible workarounds not to trigger the crash:
public func read(for url: String) -> T? {
with `@inline(never)`
The SIL of inlined and nonline variant for crashing `public func read(for url: String) -> T? {` looks identical to me (apart from the mangled signature).
The text was updated successfully, but these errors were encountered: