re PR rtl-optimization/46440 (ICE: in rtl_verify_flow_info, at cfgrtl.c:2165 with...
authorJakub Jelinek <jakub@redhat.com>
Wed, 17 Nov 2010 13:02:31 +0000 (14:02 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 17 Nov 2010 13:02:31 +0000 (14:02 +0100)
PR rtl-optimization/46440
* combine.c (update_cfg_for_uncondjump): When changing
an indirect jump into unconditional jump, remove BARRIERs
from bb's footer.

* gcc.dg/pr46440.c: New test.

From-SVN: r166867

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr46440.c [new file with mode: 0644]

index a1315493731afe67eb89b538ad508a1cd95a0f42..3fa0b566d4dbbb4578a66f8eec3e62b21158fb7b 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/46440
+       * combine.c (update_cfg_for_uncondjump): When changing
+       an indirect jump into unconditional jump, remove BARRIERs
+       from bb's footer.
+
 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
 
        * opts.c (target_handle_option): Do not assert that loc ==
index d55ce3127d809048e5f6f28c21bbcabef840aba0..c557e8c65c85a624a9b26f79a9e52317ba72742b 100644 (file)
@@ -2460,7 +2460,25 @@ update_cfg_for_uncondjump (rtx insn)
 
   delete_insn (insn);
   if (at_end && EDGE_COUNT (bb->succs) == 1)
-    single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
+    {
+      rtx insn;
+
+      single_succ_edge (bb)->flags |= EDGE_FALLTHRU;
+
+      /* Remove barriers from the footer if there are any.  */
+      for (insn = bb->il.rtl->footer; insn; insn = NEXT_INSN (insn))
+       if (BARRIER_P (insn))
+         {
+           if (PREV_INSN (insn))
+             NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
+           else
+             bb->il.rtl->footer = NEXT_INSN (insn);
+           if (NEXT_INSN (insn))
+             PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
+         }
+       else if (LABEL_P (insn))
+         break;
+    }
 }
 
 /* Try to combine the insns I0, I1 and I2 into I3.
index 3f2958cdc9506d51208812a1ff484e3d9a23ade2..4c94254b9ec852b2e2fa8c621e8cd0c34f214433 100644 (file)
@@ -1,5 +1,8 @@
 2010-11-17  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/46440
+       * gcc.dg/pr46440.c: New test.
+
        PR testsuite/45429
        * gcc.dg/vect/no-section-anchors-vect-64.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr46440.c b/gcc/testsuite/gcc.dg/pr46440.c
new file mode 100644 (file)
index 0000000..12a9997
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/46440 */
+/* { dg-do compile } */
+/* { dg-options "-O -fstack-protector -fno-tree-dominator-opts -fno-tree-fre" } */
+/* { dg-require-effective-target fstack_protector } */
+
+int i;
+
+void bar (char *);
+
+void
+foo (void)
+{
+  void *l;
+  char c[64];
+  bar (c);
+  i = 1;
+  if (i)
+    l = &&l1;
+  else
+    l = &&l2;
+  goto *l;
+l2:
+  __builtin_abort ();
+l1:;
+}