Skip to content

IRGen: Make sure we compare equal units in type size comparison #16453

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

Conversation

aschwaighofer
Copy link
Contributor

This is in some code to initialize variables for the debugger.

From the original commit
"Zero-initialize uninitialized Dictionary variables for the debugger.

To avoid the debugger displaying garbage or having expressions crash
when inspecting an uninitialized dictionary variable, zero-initialize
the first word of the alloca at -Onone.
"

Unfortunately, we are comparing different quantities in that code.

rdar://40043512

This is in some code to initialize variables for the debugger.

From the original commit
"Zero-initialize uninitialized Dictionary variables for the debugger.

To avoid the debugger displaying garbage or having expressions crash
when inspecting an uninitialized dictionary variable, zero-initialize
the first word of the alloca at -Onone.
"

Unfortunately, we are comparing different quantities in that code.

rdar://40043512
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test and merge

@@ -4017,7 +4017,7 @@ void IRGenSILFunction::visitAllocStackInst(swift::AllocStackInst *i) {
return;

auto &DL = IGM.DataLayout;
if (DL.getTypeSizeInBits(AI->getAllocatedType()) < DL.getPointerSize())
if (DL.getTypeSizeInBits(AI->getAllocatedType()) < DL.getPointerSizeInBits())
Copy link
Contributor

Choose a reason for hiding this comment

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

Ouch. Thanks! That makes sense.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test linux

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@aschwaighofer aschwaighofer merged commit dc5827c into swiftlang:master May 9, 2018
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