]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/77516 (ICE in is_gimple_min_invariant, at gimple-expr.c:706)
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:20:41 +0000 (09:20 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:20:41 +0000 (09:20 +0200)
Backported from mainline
2016-09-08  Jakub Jelinek  <jakub@redhat.com>

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: r248604

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr77516.f90 [new file with mode: 0644]

index 1eea27323c0245ebeaaf8d84feedf58ca1e08c3a..c2537a15da9a1a8547f3c29f270de5295c4df9c8 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-09-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77516
+       * omp-low.c (lower_rec_simd_input_clauses): Use max_vf for non-positive
+       OMP_CLAUSE_SAFELEN_EXPR.
+
        2016-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/77363
index 55afc60ed854eacf214c4c11cc928573b6a1e56e..0ea879f37100e21c3139e4187bd71fe59b2b65ce 100644 (file)
@@ -3546,7 +3546,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)
index 16f15aaa6751f61f20016fedde026efe2c5f0d83..828e2a9b082abc7499d675f4c4fcc97f74727c78 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-09-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77516
+       * gfortran.dg/gomp/pr77516.f90: New test.
+
        2016-09-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/77396
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 b/gcc/testsuite/gfortran.dg/gomp/pr77516.f90
new file mode 100644 (file)
index 0000000..7852abf
--- /dev/null
@@ -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