From: Peter Bergner Date: Fri, 12 May 2017 17:13:07 +0000 (-0500) Subject: re PR middle-end/80707 (r247844 causes error: extra outgoing edge) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=284d1f76e9b9411a30c43d3d366855debdb31f6a;p=gcc.git re PR middle-end/80707 (r247844 causes error: extra outgoing edge) gcc/ PR middle-end/80707 * tree-cfg.c: Remove cfg edges of unreachable case statements. gcc/testsuite/ PR middle-end/80707 * g++.dg/pr80707.C: New test. From-SVN: r247984 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4339e570b6e..197c75b1ace 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-05-12 Peter Bergner + + PR middle-end/80707 + * tree-cfg.c: Remove cfg edges of unreachable case statements. + 2017-05-12 Will Schmidt * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add handling for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 82cd82d52f0..28664c78cdb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-12 Peter Bergner + + PR middle-end/80707 + * g++.dg/pr80707.C: New test. + 2017-05-12 Will Schmidt * gcc.target/powerpc/fold-vec-div-float.c: New. diff --git a/gcc/testsuite/g++.dg/pr80707.C b/gcc/testsuite/g++.dg/pr80707.C new file mode 100644 index 00000000000..4fe89335e31 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr80707.C @@ -0,0 +1,29 @@ +// PR middle-end/80707 ICE: extra outgoing edge causes verify_flow_info error. +// { dg-do compile } +// { dg-options "-O3" } */ + +struct A { + int m_fn1(int &) const; +}; +int A::m_fn1(int &p1) const { + int a[6]; + int b = 0; + for (int i;; i++) { + if (a[i]) + break; + b++; + } + while (b) { + int c; + switch (b) { + case 1: + c = 0; + break; + case 5: + c = a[0]; + } + if (c) + p1 = 0; + b--; + } +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 77cb3d62368..72c52840cd4 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1684,6 +1684,10 @@ group_case_labels_stmt (gswitch *stmt) || (EDGE_COUNT (base_bb->succs) == 0 && gimple_seq_unreachable_p (bb_seq (base_bb)))) { + edge e; + if (base_bb != default_bb + && (e = find_edge (gimple_bb (stmt), base_bb)) != NULL) + remove_edge_and_dominated_blocks (e); gimple_switch_set_label (stmt, i, NULL_TREE); i++; new_size--;