struct S { int a : 21; unsigned char b : 3; } s; int main () { s.b = 4; if (s.b > 0 && s.b < 4) __builtin_abort (); return 0; }
See http://gcc.gnu.org/ml/gcc-bugs/2008-10/msg01324.html Works till 4.2, fails at -O with 4.3 and trunk. -- Summary: [4.3/4.4 Regression] Bitfield miscompilation Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37882