re PR fortran/77516 (ICE in is_gimple_min_invariant, at gimple-expr.c:706)
authorJakub Jelinek <jakub@redhat.com>
Thu, 8 Sep 2016 12:18:16 +0000 (14:18 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 8 Sep 2016 12:18:16 +0000 (14:18 +0200)
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
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr77516.f90 [new file with mode: 0644]

index f31907a88248e058b9e5d160c919d937e18ef10c..b9e71731f49c8a2546d8e718de45ba7f8ee4ef9e 100644 (file)
@@ -1,3 +1,9 @@
+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-09-07  David Malcolm  <dmalcolm@redhat.com>
 
        * Makefile.in (OBJS): Add substring-locations.o.
index 7c11b5043519b325df7cc3afcf7c2f4cad6f6711..c890e83a401bde725e8539304cfa0c4a725bf988 100644 (file)
@@ -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)
index 03af3a386d23d28ef88dd39131abbae016bbeb21..9075d486511ef72cac21266ee7e1352947f1fadf 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77516
+       * gfortran.dg/gomp/pr77516.f90: New test.
+
 2016-09-07  Jakub Jelinek  <jakub@redhat.com>
 
        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 (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