[Bug c/94338] struct member alignment is not carried over to alignment of struct variable
huaixin.chx@alibaba-inc.com
gcc-bugzilla@gcc.gnu.org
Fri Mar 27 09:57:17 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94338
--- Comment #6 from huaixin chang <huaixin.chx@alibaba-inc.com> ---
(In reply to joseph@codesourcery.com from comment #3)
> 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.".
Yes, I tested with _Alignas and got that error.
More information about the Gcc-bugs
mailing list