This is an archive of the discontinued LLVM Phabricator instance.

Fix handling of bit-fields in a union
ClosedPublic

Authored by shafik on Nov 9 2020, 8:54 PM.

Details

Summary

When laying out bit-fields we don't properly take into account when they are in a union, they will all have a zero offset.

Diff Detail

Event Timeline

shafik requested review of this revision.Nov 9 2020, 8:54 PM
shafik created this revision.

Should we maybe check that the offset is 0 instead of skipping the sanity check? Otherwise this LGTM.

teemperor requested changes to this revision.Nov 10 2020, 8:49 AM
This revision now requires changes to proceed.Nov 10 2020, 8:49 AM
shafik updated this revision to Diff 304354.Nov 10 2020, 4:22 PM

Add a check to make sure the bit offset is zero for fields in a union.

teemperor accepted this revision.Nov 12 2020, 8:19 AM

LGTM, thanks!

This revision is now accepted and ready to land.Nov 12 2020, 8:19 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 12 2020, 2:09 PM