From 8ebc1e0f8ee2e46d3dfc27a4b9a339074378d883 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 8 Sep 2016 14:18:16 +0200 Subject: [PATCH] re PR fortran/77516 (ICE in is_gimple_min_invariant, at gimple-expr.c:706) PR fortran/77516 * omp-low.c (lower_rec_simd_input_clauses): Use max_vf for non-positive OMP_CLAUSE_SAFELEN_EXPR. * gfortran.dg/gomp/pr77516.f90: New test. From-SVN: r240037 --- gcc/ChangeLog | 6 ++++++ gcc/omp-low.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/gomp/pr77516.f90 | 12 ++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr77516.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f31907a8824..b9e71731f49 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-08 Jakub Jelinek + + PR fortran/77516 + * omp-low.c (lower_rec_simd_input_clauses): Use max_vf for non-positive + OMP_CLAUSE_SAFELEN_EXPR. + 2016-09-07 David Malcolm * Makefile.in (OBJS): Add substring-locations.o. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 7c11b504351..c890e83a401 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4302,7 +4302,9 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx, int &max_vf, { tree c = find_omp_clause (gimple_omp_for_clauses (ctx->stmt), OMP_CLAUSE_SAFELEN); - if (c && TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST) + if (c + && (TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST + || tree_int_cst_sgn (OMP_CLAUSE_SAFELEN_EXPR (c)) != 1)) max_vf = 1; else if (c && compare_tree_int (OMP_CLAUSE_SAFELEN_EXPR (c), max_vf) == -1) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 03af3a386d2..9075d486511 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-08 Jakub Jelinek + + PR fortran/77516 + * gfortran.dg/gomp/pr77516.f90: New test. + 2016-09-07 Jakub Jelinek PR middle-end/77475 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 b/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 new file mode 100644 index 00000000000..7852abf8bcf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 @@ -0,0 +1,12 @@ +! PR fortran/77516 +! { dg-do compile } + +program pr77516 + integer :: i, x + x = 0 +!$omp simd safelen(0) reduction(+:x) + do i = 1, 8 + x = x + 1 + end do + print *, x +end -- 2.30.2