Skip to content
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-10587] Release mode optimization causes crash #52987

Closed
swift-ci opened this issue Apr 30, 2019 · 2 comments
Closed

[SR-10587] Release mode optimization causes crash #52987

swift-ci opened this issue Apr 30, 2019 · 2 comments
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 run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10587
Radar rdar://problem/50339329
Original Reporter codezy (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 10.2.1

swift 5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, OptimizedOnly, RunTimeCrash
Assignee None
Priority Medium

md5: a13145c72556b1a498a55d23d6badc74

Issue Description:

Recently when running a TestFlight build of an app I found that it was crashing in one place. When I went to debug I was unable to replicate. I flipped the configuration to a release configuration and then was able to replicate. Oddly, the code broke on one function but the call stack suggested a much deeper stack which eventually ended in a swift release call. After DAYS of trial and error I finally nailed the code down to one specific area. Then I tried a few different ways of phrasing the code and found a way where it would crash and a way where it would not.

Steps to Reproduce:

  1. Unzip the attachment and open the project in Xcode 10.2.1
  2. Ensure in edit scheme that the run configuration is set to release.
  3. Comment out the two lines in ViewController.swift labeled “B” and run
  4. It should crash
  5. Comment out the two lines labeled “A” and uncomment “B”
  6. Run and witness no crash
  7. Flip the configuration to debug and repeat steps 3-6 noting that neither code crashes, not even A which crashes when it is set to release

Expected Results:
That the optimization levels changing does not cause a crash.

Actual Results:
The optimization levels (not sure which) causes a crash

Version/Build:
Xcode 10.2.1

FILED as radar 50339329

@theblixguy
Copy link
Collaborator

cc @eeckstein

@swift-ci
Copy link
Collaborator Author

Comment by Paul Thorsteinson (JIRA)

I can confirm that, as per the info from @theblixguy below, this issue no longer occurs in 51. Thank you!

"Your project no longer crashes for me when I use a Swift 5.1 development toolchain. Apparently this was a bug with escape analysis - for now, you can just pass '-Xllvm -sil-disable-pass=stack-promotion' to fix the crash until Swift 5.1 is out."

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

3 participants