http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48377
--- Comment #29 from rguenther at suse dot de <rguenther at suse dot de> 2011-04-07 13:21:20 UTC --- On Thu, 7 Apr 2011, jakub at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48377 > > --- Comment #28 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-07 > 13:16:13 UTC --- > I mean a and g are 8 with -m64 -malign-power, but f is 4. If you do: > extern void abort (void); > struct S { long long x; int a; double b[10000]; int c; } s; > double *p = &s.b[0]; Here's a known type-inconsistency as well. Or it's even an invalid testcase ... > int > main () > { > if (((long) p) & (__alignof__ (*p) - 1)) > abort (); > return 0; > } > > I believe it will fail with -m64 -malign-power, and here it doesn't help at > all > that you check get_object_alignment, because __alignof__ (*p) is still 8, > but > .comm s,80016,8 > ... > p: > .quad s+12 > This isn't the default ABI for powerpc64-linux fortunately, but anyway. > > But, the above fails on i?86 too (without non-default -malign-double). > So, we need some target hook that will tell us if ADJUST_FIELD_ALIGN could > ever > lower alignment of the type when present in structs... Well. It's also wrong with struct S { long long x; int a; double b[10000]; int c; } s __attribute__((aligned(4))); double *p = &s.b[0]; on x86_64. And honestly I'm not exactly sure if that situation is different than the i?86 or ppc one or if it is just a "bug" in the C standard that it allows this kind of alignment behavior (and thus, a bug in the GCC extension that allows adjusting it). Richard.