]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid terminating early in LRA, unless -fchecking (PR57676)
authorBernd Schmidt <bernds@redhat.com>
Fri, 4 Mar 2016 14:12:36 +0000 (14:12 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Fri, 4 Mar 2016 14:12:36 +0000 (14:12 +0000)
gcc/
PR rtl-optimization/57676
* lra-assigns.c (lra_assign): Guard test for maximum iterations
with flag_checking.

gcc/testsuite/
PR rtl-optimization/57676
* gcc.dg/torture/pr57676.c: New test.

From-SVN: r233967

gcc/ChangeLog
gcc/lra-assigns.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr57676.c [new file with mode: 0644]

index 551044c1c07ebbb43c359fec73afee83178f0cc9..976e6fa8f51b8cbdcddee339575a7a03e6c1e9d7 100644 (file)
@@ -1,9 +1,14 @@
+2016-03-04  Bernd Schmidt  <bschmidt@redhat.com>
+
+       PR rtl-optimization/57676
+       * lra-assigns.c (lra_assign): Guard test for maximum iterations
+       with flag_checking.
+
 2016-03-04  Ilya Enkovich  <enkovich.gnu@gmail.com>
 
        * tree-vect-patterns.c (search_type_for_mask): Handle
        comparison of booleans.
 
-
 2016-03-04  Jakub Jelinek  <jakub@redhat.com>
 
        * doc/extend.texi (__builtin_alloca, __builtin_alloca_with_align):
index 1d9693ad618ff32528f1bd77270cd78400106cb7..fb3de849ec1191761946c57ebac007fb17b393f6 100644 (file)
@@ -1620,7 +1620,12 @@ lra_assign (void)
   timevar_pop (TV_LRA_ASSIGN);
   if (former_reload_pseudo_spill_p)
     lra_assignment_iter_after_spill++;
-  if (lra_assignment_iter_after_spill > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER)
+  /* This is conditional on flag_checking because valid code can take
+     more than this maximum number of iteration, but at the same time
+     the test can uncover errors in machine descriptions.  */
+  if (flag_checking
+      && (lra_assignment_iter_after_spill
+         > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER))
     internal_error
       ("Maximum number of LRA assignment passes is achieved (%d)\n",
        LRA_MAX_ASSIGNMENT_ITERATION_NUMBER);
index 5faeb8617beccde8c2ba6bcec6a518d8d8b1f577..e4770e700b2c7ce62e0f6b461297da58ad7ce575 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-04  Bernd Schmidt  <bschmidt@redhat.com>
+
+       PR rtl-optimization/57676
+       * gcc.dg/torture/pr57676.c: New test.
+
 2016-03-04  Ilya Enkovich  <enkovich.gnu@gmail.com>
 
        * gcc.dg/pr70026.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr57676.c b/gcc/testsuite/gcc.dg/torture/pr57676.c
new file mode 100644 (file)
index 0000000..a8cacc6
--- /dev/null
@@ -0,0 +1,28 @@
+/* Verify that LRA does not abort prematurely in a release build of the
+   compiler.  */
+/* { dg-do compile } */
+/* { dg-options "-fno-checking -w -funroll-loops" } */
+
+int a, b, c;
+
+void f(p1)
+{
+    for(;;)
+    {
+        if(p1 ? : (c /= 0))
+        {
+            int d;
+
+            for(; d; d++)
+            {
+                for(b = 0; b < 4; b++)
+                    p1 /= p1;
+lbl:
+                while(a);
+            }
+        }
+
+        if((c &= 1))
+            goto lbl;
+    }
+}