]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/84960 (ICE in GIMPLE pass: isolate-paths)
authorJakub Jelinek <jakub@redhat.com>
Wed, 21 Mar 2018 20:53:16 +0000 (21:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 21 Mar 2018 20:53:16 +0000 (21:53 +0100)
PR tree-optimization/84960
* tree-cfg.c (remove_bb): Don't move forced labels into bb->prev_bb
if it is ENTRY block, move them into single succ of ENTRY in that case.

* gcc.c-torture/compile/pr84960.c: New test.

From-SVN: r258744

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr84960.c [new file with mode: 0644]
gcc/tree-cfg.c

index 2c5ed01e3f44b1cc0f1b03518325b91801383008..eeab1f1a3aa795a8497b267154195efb14985818 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/84960
+       * tree-cfg.c (remove_bb): Don't move forced labels into bb->prev_bb
+       if it is ENTRY block, move them into single succ of ENTRY in that case.
+
 2018-03-21  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR tree-optimization/84811
index 36e16266c005e65ab70a53494cc2330c4436dcfc..faf418dd1b1fd226af477506823014fc6459a783 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/84960
+       * gcc.c-torture/compile/pr84960.c: New test.
+
 2018-03-21  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR tree-optimization/84811
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr84960.c b/gcc/testsuite/gcc.c-torture/compile/pr84960.c
new file mode 100644 (file)
index 0000000..b076f79
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR tree-optimization/84960 */
+/* { dg-do compile { target indirect_jumps } } */
+
+void
+foo (unsigned int a, float b, void *c)
+{
+lab:
+  if ((b - (a %= 0) < 1U) * -1U)
+    ;
+  else
+    {
+      unsigned int f = a;
+      __builtin_unreachable ();
+      c = &&lab;
+    }
+  goto *c;
+}
index b87e48dade6309c9668f21f106d1d53d30a0cb40..9485f73f341eeae44e40d3739aec3cead4068ac3 100644 (file)
@@ -2301,6 +2301,12 @@ remove_bb (basic_block bb)
                }
 
              new_bb = bb->prev_bb;
+             /* Don't move any labels into ENTRY block.  */
+             if (new_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+               {
+                 new_bb = single_succ (new_bb);
+                 gcc_assert (new_bb != bb);
+               }
              new_gsi = gsi_start_bb (new_bb);
              gsi_remove (&i, false);
              gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT);