New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-10756] Encodable crash when using -Os optimization is used #53146
Comments
By -O1 I'm assuming you mean just -O? ("Optimize for Speed" in Xcode). Or -Onone? |
Is this a project you can share? This probably isn't enough information to track down the issue. |
Comment by Tomas Srna (JIRA) @belkadan The functioning optimization is "Fast [-O, O1]". As for the code, I'll try to isolate the problem and upload a mini project this week. |
That's not a Swift optimization setting; changing it does not affect how the Swift code in your target is built. |
Comment by Tomas Srna (JIRA) @belkadan for Swift Compiler - Code Generation it is -Onone that works and -O that doesn't |
Comment by Tomas Srna (JIRA) I tried to isolate the problem, but couldn't reproduce outside our project, which is not public, under heavy NDA. I'll try and send the crashlog, maybe it could help. 2019-05-22_08-26-28.8305_+0200-ec3f7a17da0884e8a195cc8c543c67da8b004207.crash |
Thanks. @eeckstein, shajrawi (JIRA User), does this sound familiar? |
That's really hard to say without the project. |
Comment by Tomas Srna (JIRA) I tried it and the result is rather weird. `-Xllvm -sil-opt-pass-count=1` — works @eeckstein Can you give me a hint of how large <n> should I try? |
n can be quite large (> 100000) Could you do that exercise and provide the name of the bad optimization and the SIL before and after the optimization? |
Comment by Tomas Srna (JIRA) @eeckstein Thank you. To keep you posted, I am slowly approaching the N, currently the spread is +/- 50. The number is really big, at approximately 5 mil. |
Comment by Tomas Srna (JIRA) So the crashing N=4916513, N-1 doesn't crash. I'll do the second step in near future. |
Attachment: Download
Environment
Swift 5, Optimization -Os, Release
Additional Detail from JIRA
md5: 54efaf35d105951c4395268b6a8c7b8c
Issue Description:
We have a rather complex structure that is Encodable (compiler-generated, automatic).
When we use -Os optimization, the app crashes deterministically. When we turn off optimization, or use -O1, the problem disappears.
No change in code, just the optimization.
The text was updated successfully, but these errors were encountered: