[cfe-dev] Alignment of bitfield structs

Bradley Smith bradley.smith at arm.com
Tue Apr 21 02:56:22 PDT 2015


> On 21 April 2015 at 10:44, Bradley Smith <bradley.smith at arm.com> wrote:
> > From what I understand, the ABI alignment of (the actual) @g should
> be 4 since it is a struct containing int bitfields, Clang has invented
> the i40 type. Although as I said, from InstCombine's perspective the
> ABI alignment is indeed 8 as all it sees is the i40, so I don't believe
> it is InstCombine in itself that is wrong.
> 
> Right, I may be oversimplifying things, but I think Clang is
> incorrect, here. It should have created something like { i32, i32 }
> instead of { i40 }. InstCombine would probably not mess the alignment
> up.
> 
> Is that what you mean?

This could indeed be the cause, although from what I understand of the comments in CGRecordLayourBuilder this is entirely intentional behaviour. (Although I could be wrong).

Regards,
Bradley Smith






More information about the cfe-dev mailing list