[PATCH] D11034: Respect alignment of nested bitfields

John McCall rjmccall at gmail.com
Wed Jul 8 17:11:48 PDT 2015


rjmccall added a comment.

Good catch!

The better fix would be to ignore the bitfield's abstract storage alignment and instead use the base l-value's alignment, adjusted with alignmentAtOffset to the offset of the bitfield's storage.  This ensures we get the right alignment when the base l-value is *over*-aligned: in a packed struct, bitfield storage at offset 0 will have alignment 1, but if the packed struct itself is known to have alignment 4 (e.g., if it is embedded in an unpacked struct), then we still know that the storage has alignment 4.alignmentAtOffset(0) == 4.

Also, please use CreateAlignedStore and CreateAlignedLoad.


http://reviews.llvm.org/D11034







More information about the cfe-commits mailing list