On Fri, Jan 16, 2009 at 4:19 PM, Ian Lance Taylor <i...@google.com> wrote: > Adam Nemet <ane...@caviumnetworks.com> writes: > >> struct s >> { >> char a:4; >> char b:8; >> char c:4; >> } __attribute__ ((packed)) >> >> is 3 bytes long because b gets pushed to the next byte boundary. > > Sounds like a bug. > > >> The reason for this behavior is that finish_struct does not propagate packed >> to fields whose type has alignment <= BITS_PER_UNIT: > > This was introduced for PR 21166. I think you're right that the > alignment check should be ignored if the bitfield is a bitfield.
We should make sure to not introduce ABI changes (if the PR21166 change didn't change it already) and properly document even this "fixing" of the ABI, possibly emitting a default-on warning. Richard.