[Bug c++/69560] x86_64: alignof(uint64_t) produces incorrect results with -m32

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 30 00:10:00 GMT 2016


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to David Merillat from comment #0)
>         DefaultStruct s;
>         printf( "DefaultStruct: offset=%d, struct align=%d, member align=%d,
> type align=%d\n", 
>                 offsetof(DefaultStruct,i64), alignof(s), alignof(s.i64),
> alignof(int64_t) );

N.B. this isn't valid C++ or C, because the operand of alignof must be a type,
not an object.

So standard C++ doesn't even let you ask for alignof(s.i64), it only lets you
ask for the alignment of uint64_t, which for a not-sub-object is 8.


More information about the Gcc-bugs mailing list