[Bug middle-end/65922] Switch statement with __builtin_unreachable creates a wild branch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65922 Peter Bergner bergner at gcc dot gnu.org changed: What|Removed |Added Known to work||4.7.0 Known to fail||4.8.0, 4.9.0, 5.1.0, 6.0 --- Comment #1 from Peter Bergner bergner at gcc dot gnu.org --- The last tree dump looks ok to me: foo (unsigned char * ptr, unsigned int cond) { unsigned char _5; unsigned char _6; unsigned char _8; unsigned char _9; bb 2: switch (cond_2(D)) default: L7, case 0: L9, case 1 ... 4: L1, case 5: L6, case 6: L1 L1: _5 = *ptr_4(D); _6 = _5 + 1; *ptr_4(D) = _6; goto bb 6 (L9); L6: _8 = *ptr_4(D); _9 = _8 + 2; *ptr_4(D) = _9; goto bb 6 (L9); L7: __builtin_unreachable (); L9: return; } But the first rtl code after expand looks suspect to me.
[Bug middle-end/65922] Switch statement with __builtin_unreachable creates a wild branch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65922 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #2 from Andrew Pinski pinskia at gcc dot gnu.org --- Dup of bug 51513. *** This bug has been marked as a duplicate of bug 51513 ***
[Bug middle-end/65922] Switch statement with __builtin_unreachable creates a wild branch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65922 Peter Bergner bergner at gcc dot gnu.org changed: What|Removed |Added Status|RESOLVED|CLOSED --- Comment #3 from Peter Bergner bergner at gcc dot gnu.org --- Closing as a DUP. I forgot to include the test case, so for posterity, here is the test case reduced from PHP. void foo (unsigned char *ptr, unsigned int cond) { switch (cond) { case 0: return; case 1: case 2: case 3: case 4: case 6: *ptr += 1; return; case 5: *ptr += 2; return; default: __builtin_unreachable (); break; } }