Skip to content

[4.0] Prevent _swift_runtime_on_report from having its arguments optimized out. #10457

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

Merged
merged 1 commit into from
Jun 22, 2017
Merged

[4.0] Prevent _swift_runtime_on_report from having its arguments optimized out. #10457

merged 1 commit into from
Jun 22, 2017

Conversation

kubamracek
Copy link
Contributor

@kubamracek kubamracek commented Jun 21, 2017

Prevent _swift_runtime_on_report from having its arguments optimized out. Turns out an empty "asm volatile" isn't enough and we need to explicitly ask that the arguments are also not optimized out.

Explanation: The call to the Swift runtime issue reporting debugger hook can get optimized in a way that we don't pass the correct values to the debugger. The fix forces the compiler not to optimize the arguments out.
Scope: When the debugger is not attached, the bug doesn't affect anything. With the LLDB integration of Swift runtime issues, the bug can cause invalid data to be passed to the debugger.
Radar: rdar://problem/32905453
Risk: Very low risk. The fix just prevents the compiler from optimizing arguments away.
Testing: I verified that an optimized build of Swift standard library correctly passes the arguments and provides the info to the debugger.

…out. Turns out an empty "asm volatile" isn't enough and we need to explicitly ask that the arguments are also not optimized out.
@kubamracek kubamracek added this to the Swift 4.0 milestone Jun 21, 2017
@kubamracek kubamracek requested a review from DougGregor June 21, 2017 20:26
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kubamracek
Copy link
Contributor Author

@swift-ci please smoke test

@kubamracek
Copy link
Contributor Author

@swift-ci please test

@tkremenek tkremenek merged commit 5cefa3b into swiftlang:swift-4.0-branch Jun 22, 2017
@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 9b4898f
Test requested by - @kubamracek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants