re PR target/60598 (ICE in maybe_record_trace_start, at dwarf2cfi.c:2239)
authorRichard Henderson <rth@gcc.gnu.org>
Fri, 21 Mar 2014 15:31:25 +0000 (08:31 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 21 Mar 2014 15:31:25 +0000 (08:31 -0700)
PR target/60598

* ifcvt.c (dead_or_predicable): Return FALSE if there are any frame
related insns after epilogue_completed.
* gcc.dg/pr60598.c: New test.

From-SVN: r208749

gcc/ChangeLog
gcc/ifcvt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr60598.c [new file with mode: 0644]

index 57a7688de32f18563e50fadb4461b490c0dd5b14..32540368464dea5f0fb539b1e7c11717621cc69f 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-21  Richard Henderson  <rth@twiddle.net>
+
+       PR target/60598
+       * ifcvt.c (dead_or_predicable): Return FALSE if there are any frame
+       related insns after epilogue_completed.
+
 2014-03-21  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/59176
index 79aa2f3092eea0f67d92499f6d3d760f2ec71aa7..0d1adce952e0153ef66326ecaa72315e736b46a7 100644 (file)
@@ -4144,6 +4144,21 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
        end = PREV_INSN (end);
     }
 
+  /* Don't move frame-related insn across the conditional branch.  This
+     can lead to one of the paths of the branch having wrong unwind info.  */
+  if (epilogue_completed)
+    {
+      rtx insn = head;
+      while (1)
+       {
+         if (INSN_P (insn) && RTX_FRAME_RELATED_P (insn))
+           return FALSE;
+         if (insn == end)
+           break;
+         insn = NEXT_INSN (insn);
+       }
+    }
+
   /* Disable handling dead code by conditional execution if the machine needs
      to do anything funny with the tests, etc.  */
 #ifndef IFCVT_MODIFY_TESTS
index 9740621934c6d9cf0d0bf9fe322069ffad001ecf..a04e2d02896faf16d662bab44a1f59e38bbe03bb 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/60598
+       * gcc.dg/pr60598.c: New test.
+
 2014-03-21  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/59176
diff --git a/gcc/testsuite/gcc.dg/pr60598.c b/gcc/testsuite/gcc.dg/pr60598.c
new file mode 100644 (file)
index 0000000..331e8bd
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR target/60598 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+/* { dg-additional-options "-march=z196 -mtune=zEC12" { target s390*-*-* } } */
+
+struct S { unsigned a, b[32]; };
+
+void
+foo (struct S *x, struct S *y)
+{
+  unsigned a = y->a, i;
+  if (x == y)
+    for (i = 0; i < a - 1 - i; i++)
+      {
+       unsigned t = x->b[i];
+       x->b[i] = x->b[a - 1 - i];
+       x->b[a - 1 - i] = t;
+      }
+  else
+    {
+      x->a = a;
+      for (i = 0; i < a; i++)
+       x->b[i] = y->b[a - 1 - i];
+    }
+}