[Bug c++/69560] x86_64: alignof(uint64_t) produces incorrect results with -m32
david.merillat at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 29 23:39:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69560
--- Comment #4 from David Merillat <david.merillat at gmail dot com> ---
(In reply to Jonathan Wakely from comment #2)
> See ADJUST_FIELD_ALIGN at
> https://gcc.gnu.org/onlinedocs/gccint/Storage-Layout.html#Storage-Layout
>
> unsigned long long on x86 is such a type.
Thank you for the pointers into GCC internals, of which I was unaware.
However, the C++14 specification makes no mention of weaker alignment
requirements for structure members that I could find.
In fact, the specification for alignof() in C++14 is remarkably similar to that
of _Alignof in C11 (I would assume one is derived from the other. _Alignof
yields what I believe to be the correct answer in this case:
######################################################## test2.c
#include <stdio.h>
#include <stdalign.h>
#include <stdint.h>
int main(void)
{
printf( "_Alignof(int64_t) = %d\n", _Alignof(int64_t) );
return 0;
}
##########################################################
gcc -std=C11 test2.c -o test2 -m32
##########################################################
_Alignof(int64_t) = 4
##########################################################
More information about the Gcc-bugs
mailing list