This is an archive of the discontinued LLVM Phabricator instance.

Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)
ClosedPublic

Authored by hans on Jun 21 2016, 12:56 PM.

Details

Summary

It currently only takes 2048 gotos to overflow the FixupDepth bitfield, causing silent miscompilation. Apparently some parser generators run into this (see PR).

I don't know that that data structure is terribly size sensitive anyway, and since there's no room to widen the bitfield, let's just use a separate word for it.

Diff Detail

Event Timeline

hans updated this revision to Diff 61428.Jun 21 2016, 12:56 PM
hans retitled this revision from to Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490).
hans updated this object.
hans added a reviewer: rjmccall.
hans added a subscriber: cfe-commits.
rjmccall edited edge metadata.Jun 22 2016, 8:44 AM

Yeah, 2048 is clearly too few. The other changes aren't necessary; if we're going to try to be that generous, there's a lot of places in the AST that need to be updated.

lib/CodeGen/CGCleanup.h
61

This one seems unnecessary. 29 bits is fine.

88–89

This should just be pulled out of the BitFields structure and into the EHCleanup class.

95

This one is also unnecessary.

hans updated this revision to Diff 61560.Jun 22 2016, 9:09 AM
hans edited edge metadata.
hans marked 3 inline comments as done.

Addressing comments.

hans added a comment.Jun 22 2016, 9:10 AM

Thanks for the review! Please take another look.

lib/CodeGen/CGCleanup.h
88–89

That's probably a better way to do it. Thanks.

That looks great, thanks.

This revision was automatically updated to reflect the committed changes.