re PR tree-optimization/71462 (gcc ICE at -O3 on valid code on x86_64-linux-gnu...
authorRichard Biener <rguenther@suse.de>
Thu, 9 Jun 2016 11:36:22 +0000 (11:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 9 Jun 2016 11:36:22 +0000 (11:36 +0000)
2016-06-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/71462
* tree-ssa-loop-manip.c (find_uses_to_rename): Guard against
removed blocks.

* gcc.dg/torture/pr71462.c: New testcase.

From-SVN: r237254

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr71462.c [new file with mode: 0644]
gcc/tree-ssa-loop-manip.c

index 3484047c15c496d636666c6c6f8849842cbfc11d..134f2249396a11f3e9e4fad9f6eb03ebdcafd1b2 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71462
+       * tree-ssa-loop-manip.c (find_uses_to_rename): Guard against
+       removed blocks.
+
 2016-06-09  Martin Liska  <mliska@suse.cz>
 
        * predict.c (filter_predictions): New function.
index 844f0f5e0c7680e343374e86e12887ec953ccedd..8ee01b77e858f0b67ef1c0f7cd63098192761fd3 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71462
+       * gcc.dg/torture/pr71462.c: New testcase.
+
 2016-06-09  Marek Polacek  <polacek@redhat.com>
 
        PR c/65471
diff --git a/gcc/testsuite/gcc.dg/torture/pr71462.c b/gcc/testsuite/gcc.dg/torture/pr71462.c
new file mode 100644 (file)
index 0000000..390b886
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+
+short a;
+long b;
+void fn1()
+{
+  int c = a = 1;
+  for (; a; a++)
+    {
+      for (; 9 <= 8;)
+       for (;;) {
+           a = 20;
+           for (; a <= 35; a++)
+             ;
+line:;
+       }
+      if ((c += 264487869) == 9)
+       {
+         unsigned *d = 0;
+         for (; b;)
+           d = (unsigned *)&c;
+         if (d)
+           for (;;)
+             ;
+       }
+    }
+  goto line;
+}
index 77c5eb49f14a381d84511ce37f59ae92e31df731..e87d29055d9f8d56946b6a6d29e754fbae48b09d 100644 (file)
@@ -472,8 +472,11 @@ find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks, bitmap need_phis,
 
   if (changed_bbs)
     EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi)
-      find_uses_to_rename_bb (BASIC_BLOCK_FOR_FN (cfun, index), use_blocks,
-                             need_phis, use_flags);
+      {
+       bb = BASIC_BLOCK_FOR_FN (cfun, index);
+       if (bb)
+         find_uses_to_rename_bb (bb, use_blocks, need_phis, use_flags);
+      }
   else
     FOR_EACH_BB_FN (bb, cfun)
       find_uses_to_rename_bb (bb, use_blocks, need_phis, use_flags);