[Bug c/52991] attribute packed broken on mingw32?
mikpe at it dot uu.se
gcc-bugzilla@gcc.gnu.org
Sun Aug 19 20:56:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kkojima at gcc dot gnu.org
--- Comment #4 from Mikael Pettersson <mikpe at it dot uu.se> 2012-08-19 20:56:19 UTC ---
The problem started with the PR27942 fix in r114552:
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00569.html
http://gcc.gnu.org/ml/gcc-cvs/2006-06/msg00268.html
and it affects gcc-4.2.0 up to current trunk.
The problem isn't mingw-specific, it can be reproduced natively on e.g.
x86_64-linux. Take this C test case, reduced from #c1:
struct A {
short s;
struct { int i; } x;
} __attribute__((__packed__));
struct C {
struct { int i; } x;
short s;
} __attribute__((__packed__));
int foo(void)
{
return sizeof(struct A) == sizeof(struct C);
}
Compiling this with -mno-ms-bitfields makes foo() return 1, but compiling with
-mms-bitfields makes foo() return 0 because sizeof(struct A) then is 8 while
sizeof(struct C) still is 6.
More information about the Gcc-bugs
mailing list