[PATCH] Fix another __builtin_unreachable () ICE (PR bootstrap/42347)
Jakub Jelinek
jakub@redhat.com
Mon May 17 14:55:00 GMT 2010
Hi!
The http://gcc.gnu.org/ml/gcc-patches/2009-09/msg01046.html
fix apparently assumed only !onlyjump_p sideffects can lead into
an conditional jump not being redirected and/or optimized away.
But conditional return jumps apparently aren't redirected/removed either,
and comments like
/* A return instruction can't be redirected. */
in cfgrtl.c suggest that is intentional. So, this patch just allows
also conditional return jumps.
Ok for trunk/4.5?
2010-05-17 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/42347
* cfglayout.c (fixup_reorder_chain): Allow returnjump_p
to have no fallthru edge.
* gcc.c-torture/compile/pr42347.c: New test.
--- gcc/cfglayout.c.jj 2010-05-13 12:21:21.000000000 +0200
+++ gcc/cfglayout.c 2010-05-17 15:09:08.000000000 +0200
@@ -793,7 +793,8 @@ fixup_reorder_chain (void)
to prevent rtl_verify_flow_info from complaining. */
if (!e_fall)
{
- gcc_assert (!onlyjump_p (bb_end_insn));
+ gcc_assert (!onlyjump_p (bb_end_insn)
+ || returnjump_p (bb_end_insn));
bb->il.rtl->footer = emit_barrier_after (bb_end_insn);
continue;
}
--- gcc/testsuite/gcc.c-torture/compile/pr42347.c.jj 2010-05-17 15:18:12.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr42347.c 2010-05-17 15:19:40.000000000 +0200
@@ -0,0 +1,16 @@
+/* PR bootstrap/42347 */
+
+long
+foo (long x, long y)
+{
+ x = x & y;
+ switch (y)
+ {
+ case 63L: x >>= 0; break;
+ case 4032L: x >>= 6; break;
+ case 258048L: x >>= 12; break;
+ case 16515072L: x >>= 18; break;
+ default: __builtin_unreachable ();
+ }
+ return x;
+}
Jakub
More information about the Gcc-patches
mailing list