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

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 26 17:50:05 GMT 2020


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

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
It's a mistake to be referring to the C standard for the interpretation of 
alignment attributes.  The C standard way of specifying alignment is 
_Alignas, not __attribute__, and if you write equivalent code using 
_Alignas you get an error "error: '_Alignas' specifiers cannot reduce 
alignment of 'A'", which corresponds to the constraint "The combined 
effect of all alignment specifiers in a declaration shall not specify an 
alignment that is less strict than the alignment that would otherwise be 
required for the type of the object or member being declared.".


More information about the Gcc-bugs mailing list