This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53881] [4.8 regression] ICE in hoist_edge_and_branch_if_true
- From: "steven at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 06 Jul 2012 23:28:55 +0000
- Subject: [Bug c/53881] [4.8 regression] ICE in hoist_edge_and_branch_if_true
- Auto-submitted: auto-generated
- References: <bug-53881-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53881
--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> 2012-07-06 23:28:55 UTC ---
The problem is that the switch is not fully cleaned up, there are multiple case
labels going to the same target basic block:
(gdb) p debug_bb(e->src)
;; basic block 2, loop depth 0, count 0
;; prev block 0, next block 3
;; pred: ENTRY (fallthru,exec)
;; succ: 3 (exec) 4 (exec)
<bb 2>:
a.0_1 = a;
switch (a.0_1) <default: <L4>, case 0 ... 1: <L6>, case 8: Label>
$13 = void
(gdb) p debug_bb(e->dest)
;; basic block 4, loop depth 0, count 0
;; prev block 3, next block 1
;; pred: 2 (exec) 3 (fallthru,exec)
;; succ: EXIT
Label:
<L6>:
return;
Provisional patch:
Index: tree-switch-conversion.c
===================================================================
--- tree-switch-conversion.c (revision 189341)
+++ tree-switch-conversion.c (working copy)
@@ -329,14 +329,13 @@ emit_case_bit_tests (gimple swtch, tree index_expr
unsigned int lo, hi;
tree cs = gimple_switch_label (swtch, i);
tree label = CASE_LABEL (cs);
+ edge e = find_edge (switch_bb, label_to_block (label));
for (k = 0; k < count; k++)
- if (label == test[k].label)
+ if (e == test[k].target_edge)
break;
if (k == count)
{
- edge e = find_edge (switch_bb, label_to_block (label));
- gcc_assert (e);
gcc_checking_assert (count < MAX_CASE_BIT_TESTS);
test[k].hi = 0;
test[k].lo = 0;