This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Missed bitfield packing?
- From: Ian Lance Taylor <iant at google dot com>
- To: Adam Nemet <anemet at caviumnetworks dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 16 Jan 2009 07:19:39 -0800
- Subject: Re: Missed bitfield packing?
- References: <18799.52465.712744.724161@foo.home>
Adam Nemet <anemet@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.
Ian