From: Bernd Schmidt Date: Fri, 4 Mar 2016 14:12:36 +0000 (+0000) Subject: Avoid terminating early in LRA, unless -fchecking (PR57676) X-Git-Tag: basepoints/gcc-7~587 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6c38c695832904acacf5cae38f435ef831f00e1;p=thirdparty%2Fgcc.git Avoid terminating early in LRA, unless -fchecking (PR57676) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 551044c1c07e..976e6fa8f51b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,9 +1,14 @@ +2016-03-04 Bernd Schmidt + + PR rtl-optimization/57676 + * lra-assigns.c (lra_assign): Guard test for maximum iterations + with flag_checking. + 2016-03-04 Ilya Enkovich * tree-vect-patterns.c (search_type_for_mask): Handle comparison of booleans. - 2016-03-04 Jakub Jelinek * doc/extend.texi (__builtin_alloca, __builtin_alloca_with_align): diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 1d9693ad618f..fb3de849ec11 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5faeb8617bec..e4770e700b2c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-04 Bernd Schmidt + + PR rtl-optimization/57676 + * gcc.dg/torture/pr57676.c: New test. + 2016-03-04 Ilya Enkovich * 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 index 000000000000..a8cacc630b38 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57676.c @@ -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; + } +}