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

--- Comment #7 from huaixin chang <huaixin....@alibaba-inc.com> ---
(In reply to Martin Sebor from comment #4)
> Sounds like there's agreement that the code should at least get a warning
> then, so confirmed. 
> 
> The attribute aligned section of the manual describing the variable
> attribute says:
> 
>   When used on a struct, or struct member, the aligned attribute can only
> increase the alignment...
> 
> It's not clear whether struct here refers to a type or a variable (I'm
> guessing it's former but it's in the Common Variable Attribute section so it
> could easily be read as the latter).  Either way, reducing the alignment of
> an object whose members explicitly ask for stricter alignment seems like a
> dangerous thing to do without a warning.
> 
> I'll see if I can do this for GCC 11.

It seems that the compiler thinks A.a is already aligned to 128-byte. Because
as I print alignof(A.a) and alignof(A.b) with the same definition, they are
128.

$./align
address of A 0x42003c
alignof A 4
address of A.a 0x42003c
alignof A.a 128
address of A.b 0x4200bc
alignof A.b 128

Is it in your consideration to actually align A.a to 128-byte boundary?

Reply via email to