[Bug c/53037] warn_if_not_aligned(X)
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 19 20:16:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037
--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-19 20:15:55 UTC ---
Created attachment 27197
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27197
A patch
I got
[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 -S x.i
x.i:10:1: warning: alignment 32 of ‘struct foo1’ is less than 64 [enabled by
default]
};
^
x.i:10:1: warning: ‘x’ offset 12 in ‘struct foo1’ isn't aligned to 8 [enabled
by default]
};
^
x.i:18:1: warning: ‘x’ offset 12 in ‘struct foo2’ isn't aligned to 8 [enabled
by default]
} __attribute__((aligned(8)));
^
x.i:32:1: warning: alignment 32 of ‘struct foo4’ is less than 64 [enabled by
default]
};
^
x.i:39:1: warning: alignment 32 of ‘union bar1’ is less than 64 [enabled by
default]
};
^
[hjl@gnu-6 pr53037]$
More information about the Gcc-bugs
mailing list