From: Eric Botcazou Date: Sat, 15 Sep 2018 09:21:09 +0000 (+0000) Subject: re PR middle-end/86864 (ICE in commit_one_edge_insertion on switch construct) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae486e6281fb11a3ae37ccaecc840bb4c8c2551f;p=gcc.git re PR middle-end/86864 (ICE in commit_one_edge_insertion on switch construct) PR middle-end/86864 * cfgexpand.c (expand_gimple_basic_block): Be prepared for a BARRIER before and after a JUMP_TABLE_DATA. From-SVN: r264342 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8fda90ac6ce..9f6b4b53fc4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-09-15 Eric Botcazou + + PR middle-end/86864 + * cfgexpand.c (expand_gimple_basic_block): Be prepared for a BARRIER + before and after a JUMP_TABLE_DATA. + 2018-09-14 John David Anglin PR middle-end/87188 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 697b238669f..c8d7805308c 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -5817,6 +5817,8 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) last = PREV_INSN (last); if (JUMP_TABLE_DATA_P (last)) last = PREV_INSN (PREV_INSN (last)); + if (BARRIER_P (last)) + last = PREV_INSN (last); BB_END (bb) = last; update_bb_for_insn (bb); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25c253fe9af..847f57ba95c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-09-15 Eric Botcazou + + * gcc.c-torture/compile/20180915-1.c: New test. + 2018-09-14 David Malcolm PR c/82967 diff --git a/gcc/testsuite/gcc.c-torture/compile/20180915-1.c b/gcc/testsuite/gcc.c-torture/compile/20180915-1.c new file mode 100644 index 00000000000..be5c4f03a6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20180915-1.c @@ -0,0 +1,27 @@ +/* PR middle-end/86864 */ +/* Testcase by Serge Belyshev */ + +long a; +void f (); +void g (int b, int c, int d) +{ + switch (b) + { + case 42: + case 29: + case 48: + case 40: + case 32: + c = 2; + break; + case 0: + c = 1; + break; + default: + __builtin_unreachable (); + } + if (d || a) + f (); + if (c == 1) + f (); +}