https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105588
--- Comment #4 from Hubert Tong <hstong at ca dot ibm.com> --- (In reply to Jakub Jelinek from comment #3) > _Alignof(expression) works like __alignof__(expression) which works like > __alignof__(__typeof(expression)), while _Alignof(type_name) is mandated by > the standard to work differently. Except it doesn't work that way. `__alignof__(expression)` is sensitive to what the expression is in ways other than its type: https://godbolt.org/z/GjETGnaGn ``` struct A { double d; } a; void f() { extern char x[__alignof__(__typeof(a.d))]; char (*y)[_Alignof(a.d)] = &x; // warns } ``` So, if it cares what the expression refers to, then when what is referred to is unknown, the question becomes what `_Alignof` means: Is it the guaranteed alignment (of what you were given) or the preferred alignment (for what you might allocate)? `_Alignof` already means "guaranteed alignment" in `_Alignof(type)`. > The difference is that in the ia32 psABI, double is normally 8 byte aligned, > except when inside of struct/union where the alignment is lowered to 4 byte > alignment. > Changing any of this would be a significant ABI change. There is no request here to change the result of the actual allocation used for layout or allocation purposes. Just a request to make GNU C's `_Alignof(expression)` consistent with GNU C++'s `alignof(expression)` (both being GNU extensions).