[Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973 --- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org 2011-05-12 07:20:30 UTC --- extern void abort (void); struct S { int f : 1; } s; int v = -1; void foo (void) { s.f = (v 1) 0; } void bar (unsigned int x) { if (x != -1U) abort (); } int main () { foo (); bar (s.f); return 0; }
[Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973 --- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2011-05-12 07:29:37 UTC --- extern void abort (void); struct S { int f : 1; } s; int v = -1; void foo (unsigned int x) { if (x != -1U) abort (); } int main () { s.f = (v 1) 0; foo (s.f); return 0; } Smaller testcase which failed already in 4.2, apparently introduced in between r97500 and r98750.
[Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973 --- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org 2011-05-12 07:36:07 UTC --- And even more reduced: extern void abort (void); struct S { int f : 1; } s; int v = -1; int main () { s.f = (v 1) 0; if ((unsigned int) s.f != -1U) abort (); return 0; }
[Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2011.05.12 07:19:50 CC||jakub at gcc dot gnu.org Known to work||4.2.3 Target Milestone|--- |4.3.6 Summary|Inliner bug with one-bit|[4.3/4.4/4.5/4.6/4.7 |(1-bit) bitfield|Regression] Inliner bug ||with one-bit (1-bit) ||bitfield Ever Confirmed|0 |1 Known to fail||4.3.3, 4.6.0, 4.7.0 --- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org 2011-05-12 07:19:50 UTC --- Confirmed, started in between r11 and r112000, but strangely works in 4.2 which has branched off in r117923. Looking into it.
[Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973 --- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2011-05-12 08:29:09 UTC --- Even smaller: extern void abort (void); struct S { int f : 1; } s; int v = -1; int main () { s.f = v 0; if ((unsigned int) s.f != -1U) abort (); return 0; } I'd say the bug is during expansion of a comparison with signed 1 bit type. Then the comparison needs to result 0 / -1 instead of 0 / 1. I think it would be difficult to adjust all the conditional expansion to handle this very rare special case, so probably it will be better to expand such conditionals as if it was unsigned:1 or unsigned char typed comparison, followed by cast from that type to signed:1.