http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46354

--- Comment #3 from pageexec at freemail dot hu 2010-11-07 23:33:54 UTC ---
(In reply to comment #2)
> Generally GCC lays out structures based on the types of the elemets, not
> based on the alignment specified on fields.

according to the gcc docs, explicit alignment on structure fields *is* taken
into account in that one can *increase* the natural alignment associated with a
given type:

     The `aligned' attribute can only increase the alignment; but you
     can decrease it by specifying `packed' as well.  See below.

in this bug you can see that even without the packed attribute gcc can decrease
the alignment. so either the docs or the implementation is buggy ;).

the second issue is that when one does use the packed attribute on a structure,
the resulting field alignment seems inconsistent depending on where the aligned
attribute is (typedef vs. structure field). i don't see where the docs specify
or imply this behaviour.

Reply via email to