[Bug c/94338] struct member alignment is not carried over to alignment of struct variable

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 26 09:20:52 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94338

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
            Version|lto                         |9.2.1
           Keywords|                            |diagnostic

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the testcase is ill-formed and should be diagnosed in some form.
IIRC there's some documented behavior (that's not implemented) that __aligned__
only increases alignment unless __packed__ is used.  With __packed__ the
testcase behaves as expected I think.

Note __attribute__((__aligned__(4))) applies to 'A', not its type.

Not sure if behavior changes if you use a typedef that is aligned to 4.


More information about the Gcc-bugs mailing list