This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch]: PR/39886: ICE in purge_dead_edges, at cfgrtl.c:2274
2009/9/20 Eric Botcazou <ebotcazou@adacore.com>:
>> 2009-09-20 ?Paolo Bonzini <bonzini@gnu.org>
>>
>> ? ? ? PR/39886
>> ? ? ? * combine.c (update_cfg_for_uncondjump): Set EDGE_FALLTHRU
>> ? ? ? just when insn is equal to BB_END (bb).
>
> PR rtl-optimization/39886 (please reclassify the PR in bugzilla as well)
>
>> 2009-09-20 ?Kai Tietz ?<kai.tietz@onevision.com>
>>
>> ? ? ? * gcc.c-tortue/compile/pr39886.c: New.
>>
>> Ok to apply to trunk?
>
> OK if you fix the head comment of the function as well ("conditional").
>
> --
> Eric Botcazou
>
Ok, I removed from comment the conditional, is it isn't necessary a
conditional jump.
Revised patch attached.
Ok?
Cheers,
Kai
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: gcc/gcc/combine.c
===================================================================
--- gcc.orig/gcc/combine.c 2009-09-18 07:48:35.000000000 +0200
+++ gcc/gcc/combine.c 2009-09-20 10:58:18.191377400 +0200
@@ -2363,7 +2363,7 @@
}
}
-/* Delete the conditional jump INSN and adjust the CFG correspondingly.
+/* Delete the jump INSN and adjust the CFG correspondingly.
Note that the INSN should be deleted *after* removing dead edges, so
that the kept edge is the fallthrough edge for a (set (pc) (pc))
but not for a (set (pc) (label_ref FOO)). */
@@ -2372,12 +2372,13 @@
update_cfg_for_uncondjump (rtx insn)
{
basic_block bb = BLOCK_FOR_INSN (insn);
+ bool at_end = (BB_END (bb) == insn);
- if (BB_END (bb) == insn)
+ if (at_end)
purge_dead_edges (bb);
delete_insn (insn);
- if (EDGE_COUNT (bb->succs) == 1)
+ if (at_end && EDGE_COUNT (bb->succs) == 1)
single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
}
Index: gcc/gcc/testsuite/gcc.c-torture/compile/pr39886.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/gcc/testsuite/gcc.c-torture/compile/pr39886.c 2009-09-20 09:36:38.862377400 +0200
@@ -0,0 +1,12 @@
+/* PR middle-end/39886 */
+
+int foo (int);
+
+volatile unsigned char g;
+
+void bar (int p)
+{
+ char l = 0xE1;
+ func ((foo ((p & g) <= l), 1));
+}
+