Several g++ tests in tmpdir-g++.dg-struct-layout-1 fail with the execution error. A reduced testcase is
extern "C" void abort (void); struct S { long long d:23; int e:32; int f:32; } a; int main (void) { a.e = -3; a.f = 1; if (a.e != -3) abort (); return 0; } which shows that the current compiler allocates a.e and a.f in an overlapped manner with -mms-bitfields. With that option, the 4.1 compiler allocates a field in the first 8-byte for a.d, the next 4-byte for a.e and the another 4-byte for a.f, but 4.2 allocates 23-bit for a.d, the next 32-bit for a.e and the last 32-bit for a.f in the same 8-byte. -- Summary: Wrong bit field layout with -mms-bitfields Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kkojima at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28161