Skip to content

IRGen: fix statically initialized globals which contain an empty type. #11675

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
Aug 30, 2017

Conversation

eeckstein
Copy link
Contributor

Explanation: This problem can crash the compiler with an assert or - even worse - in a non assert compiler produce wrong code for reading a global variable.

Scope of Issue: This can only happen if a global variable is a struct or tuple and one of the elements is an empty type (e.g. an empty tuple or empty struct).

Risk: Low. The fix just adds a check for the case where the compiler would have crashed.

Reviewed By: Joe Groff

Testing: There is a regression test for it

Radar: rdar://problem/34123143

This caused a compiler assert or a miscompile

rdar://problem/34123143
@eeckstein
Copy link
Contributor Author

@swift-ci test

@tkremenek tkremenek merged commit 1cfada4 into swiftlang:swift-4.0-branch Aug 30, 2017
@eeckstein eeckstein deleted the fix-static-init-4.0 branch August 30, 2017 14:39
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.

2 participants