https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66337
Bug ID: 66337 Summary: __alignof__(s.d) incorrect for a double member with -malign-power Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- As mentioned in http://gcc.gnu.org/ml/gcc-patches/2015-05/msg02145.html, the result of __alignof__(s.d) where s.d is a struct member of type double doesn't reflect the POWER ABI requirements on such members when the -malign-power option is specified and differs from the result returned by IBM xlc on AIX with the equivalent option. I searched the GCC test suite for tests exercising the option to see if I was missing something but couldn't find any. I also searched the sources to see I could find a comment explaining the difference. All I was able to find was the following in config/rs6000/{freebsd64,linux64}.h: /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ which still doesn't explain the result. Test case run with gcc 4.8 and IBM xlc 12.1 on AIX 7.1 (GCC's result is the same on Linux/POWER). If the result is expected, I'm happy to update the documentation provided someone can point me to the ABI document that outlines the requirements. $ cat t.c && gcc -malign-power t.c && ./a.out && xlc -qalign=power t.c && ./a.out #include <stdio.h> static struct { double d; } sd; int main (void) { printf ("%zu %zu\n", __alignof (sd), __alignof__ (sd.d)); return 0; } 8 4 8 8