re PR rtl-optimization/71916 (ICE at -O3 on valid code on x86_64-linux-gnu in "maybe_...
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Jul 2016 19:54:49 +0000 (21:54 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Jul 2016 19:54:49 +0000 (21:54 +0200)
PR rtl-optimization/71916
* cfgrtl.c (contains_no_active_insn_p): Return false also for
bb which have a single succ fake edge.

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

From-SVN: r238490

gcc/ChangeLog
gcc/cfgrtl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr71916.c [new file with mode: 0644]

index 351195143120bc0ed46c9086d23b7d6a28827c18..d3dfcc895a6997c4ea8948eae2c8fece0771f14e 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/71916
+       * cfgrtl.c (contains_no_active_insn_p): Return false also for
+       bb which have a single succ fake edge.
+
 2016-07-19  Aldy Hernandez  <aldyh@redhat.com>
 
        PR debug/71855
index 3d8ed60c2a0c162d962cf5e540b4f0c745517455..e1f354e69fa9afbe3e3c36c32aabf4a1f4951b77 100644 (file)
@@ -574,8 +574,10 @@ contains_no_active_insn_p (const_basic_block bb)
 {
   rtx_insn *insn;
 
-  if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)
-      || !single_succ_p (bb))
+  if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
+      || bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)
+      || !single_succ_p (bb)
+      || (single_succ_edge (bb)->flags & EDGE_FAKE) != 0)
     return false;
 
   for (insn = BB_HEAD (bb); insn != BB_END (bb); insn = NEXT_INSN (insn))
index 17fcb00d1c8202ad3658dca4a70de5ec910e2672..ceae017ce8f29bb5115b2ec21831323544e359d3 100644 (file)
@@ -1,5 +1,8 @@
 2016-07-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/71916
+       * gcc.c-torture/compile/pr71916.c: New test.
+
        PR middle-end/71874
        * g++.dg/torture/pr71874.C: New test.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71916.c b/gcc/testsuite/gcc.c-torture/compile/pr71916.c
new file mode 100644 (file)
index 0000000..95bc5b7
--- /dev/null
@@ -0,0 +1,36 @@
+/* PR rtl-optimization/71916 */
+
+int a, b, c, d, f, g;
+short h;
+
+short
+foo (short p1)
+{
+  return a >= 2 || p1 > 7 >> a ? p1 : p1 << a;
+}
+
+void
+bar (void)
+{
+  for (;;)
+    {
+      int i, j[3];
+      h = b >= 2 ? d : d >> b;
+      if (foo (f > h ^ c))
+       {
+         d = 0;
+         while (f <= 2)
+           {
+             char k[2];
+             for (;;)
+               k[i++] = 7;
+           }
+       }
+      else
+       for (;;)
+         g = j[2];
+      if (g)
+       for (;;)
+         ;
+    }
+}