diff mbox series

Fix PR middle-end/86864

Message ID 3366550.yXoTkXDyxz@polaris
State New
Headers show
Series Fix PR middle-end/86864 | expand

Commit Message

Eric Botcazou Sept. 15, 2018, 9:21 a.m. UTC
This is a regression present on the mainline: an assertion is triggered in 
commit_one_edge_insertion at expansion time because a BB contains a BARRIER in 
its BB_END, which is not valid.  expand_gimple_basic_block is supposed to 
prevent that from happening, but it doesn't properly handle the sequence:

  JUMP
  BARRIER
  JUMP_TABLE_DATA
  BARRIER

that can be generated for a switch construct.

Bootstrapped/regtested on x86_64-suse-linux, applied on mainline as obvious.


2018-09-15  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/86864
	* cfgexpand.c (expand_gimple_basic_block): Be prepared for a BARRIER
	before and after a JUMP_TABLE_DATA.


2018-09-15  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.c-torture/compile/20180915-1.c: New test.
diff mbox series

Patch

Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 264202)
+++ cfgexpand.c	(working copy)
@@ -5810,6 +5810,8 @@  expand_gimple_basic_block (basic_block b
     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);