From 1e7ef862ac809db0f6b9dfb746a12e27b7098194 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 1 Feb 2017 12:47:25 +0000 Subject: [PATCH] re PR tree-optimization/79315 (ICE while building SPEC CPU 2006 FP with -Ofast -ftree-parallelize-loops) 2017-02-01 Richard Biener PR middle-end/79315 * tree-cfg.c (move_stmt_op): Never set TREE_BLOCK when it was not set before. * gfortran.dg/pr79315.f90: New testcase. From-SVN: r245089 --- gcc/ChangeLog | 6 ++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gfortran.dg/pr79315.f90 | 52 +++++++++++++++++++++++++++ gcc/tree-cfg.c | 9 ++--- 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr79315.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b62c0b7bad..40a1a92d953 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-02-01 Richard Biener + + PR middle-end/79315 + * tree-cfg.c (move_stmt_op): Never set TREE_BLOCK when it + was not set before. + 2017-02-01 Richard Biener PR tree-optimization/71824 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dbbd485e118..489ecaf742d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-01 Richard Biener + + PR middle-end/79315 + * gfortran.dg/pr79315.f90: New testcase. + 2017-02-01 Richard Biener PR tree-optimization/71824 diff --git a/gcc/testsuite/gfortran.dg/pr79315.f90 b/gcc/testsuite/gfortran.dg/pr79315.f90 new file mode 100644 index 00000000000..8cd89691ce9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr79315.f90 @@ -0,0 +1,52 @@ +! { dg-do compile } +! { dg-require-effective-target pthread } +! { dg-options "-Ofast -ftree-parallelize-loops=4" } + +SUBROUTINE wsm32D(t, & + w, & + den, & + p, & + delz, & + its,& + ite, & + kts, & + kte & + ) + REAL, DIMENSION( its:ite , kts:kte ), & + INTENT(INOUT) :: & + t + REAL, DIMENSION( ims:ime , kms:kme ), & + INTENT(IN ) :: w, & + den, & + p, & + delz + REAL, DIMENSION( its:ite , kts:kte ) :: & + qs, & + xl, & + work1, & + work2, & + qs0, & + n0sfac + diffus(x,y) = 8.794e-5*x**1.81/y + diffac(a,b,c,d,e) = d*a*a/(xka(c,d)*rv*c*c)+1./(e*diffus(c,b)) + venfac(a,b,c) = (viscos(b,c)/diffus(b,a))**(.3333333) & + /viscos(b,c)**(.5)*(den0/c)**0.25 + do loop = 1,loops + xa=-dldt/rv + do k = kts, kte + do i = its, ite + tr=ttp/t(i,k) + if(t(i,k).lt.ttp) then + qs(i,k) =psat*(tr**xa)*exp(xb*(1.-tr)) + endif + qs0(i,k) =psat*(tr**xa)*exp(xb*(1.-tr)) + enddo + do i = its, ite + if(t(i,k).ge.t0c) then + work1(i,k) = diffac(xl(i,k),p(i,k),t(i,k),den(i,k),qs(i,k)) + endif + work2(i,k) = venfac(p(i,k),t(i,k),den(i,k)) + enddo + enddo + enddo ! big loops +END SUBROUTINE wsm32D diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 315d0e16ed0..a540416cbb5 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -6636,11 +6636,12 @@ move_stmt_op (tree *tp, int *walk_subtrees, void *data) if (EXPR_P (t)) { tree block = TREE_BLOCK (t); - if (block == p->orig_block - || (p->orig_block == NULL_TREE - && block != NULL_TREE)) + if (block == NULL_TREE) + ; + else if (block == p->orig_block + || p->orig_block == NULL_TREE) TREE_SET_BLOCK (t, p->new_block); - else if (flag_checking && block != NULL_TREE) + else if (flag_checking) { while (block && TREE_CODE (block) == BLOCK && block != p->orig_block) block = BLOCK_SUPERCONTEXT (block); -- 2.30.2