http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037
--- Comment #16 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-19 21:06:49 UTC --- Created attachment 27199 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27199 A smaller patch There is no point to support struct foo { int i1; long long i2 __attribute__((aligned(4), warn_if_not_aligned(8))); }; since GCC won't decrease alignment in field. The smaller patch gave [hjl@gnu-6 pr53037]$ cat x.i typedef unsigned long long __u64 __attribute__((aligned(4),warn_if_not_aligned(8))); struct foo1 { int i1; int i2; int i3; __u64 x; }; struct foo2 { int i1; int i2; int i3; __u64 x; } __attribute__((aligned(8))); struct foo3 { int i1; int i2; __u64 x; } __attribute__((aligned(8))); struct foo4 { int i1; int i3; __u64 x; }; union bar1 { int i1; int i3; __u64 x; }; union bar2 { int i1; int i3; __u64 x; } __attribute__((aligned(8))); [hjl@gnu-6 pr53037]$ make x.s /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -mx32 -Wall -O2 -S x.i x.i:10:1: warning: alignment 4 of ‘struct foo1’ is less than 8 [enabled by default] }; ^ x.i:9:9: warning: ‘x’ offset 12 in ‘struct foo1’ isn't aligned to 8 [enabled by default] __u64 x; ^ x.i:17:9: warning: ‘x’ offset 12 in ‘struct foo2’ isn't aligned to 8 [enabled by default] __u64 x; ^ x.i:32:1: warning: alignment 4 of ‘struct foo4’ is less than 8 [enabled by default] }; ^ x.i:39:1: warning: alignment 4 of ‘union bar1’ is less than 8 [enabled by default] }; ^ [hjl@gnu-6 pr53037]$