]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/46753 (ICE: OpenMP - in extract_omp_for_data, at omp-low...
authorJakub Jelinek <jakub@redhat.com>
Tue, 7 Dec 2010 19:01:36 +0000 (20:01 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 7 Dec 2010 19:01:36 +0000 (20:01 +0100)
Backport from mainline
2010-12-02  Jakub Jelinek  <jakub@redhat.com>

PR fortran/46753
* trans-openmp.c (gfc_trans_omp_do): Use build2_loc instead of
fold_build2_loc for OMP_FOR conditions.

* libgomp.fortran/pr46753.f90: New test.

From-SVN: r167561

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/pr46753.f90 [new file with mode: 0644]

index 6c064431a1f34a90ce0d6cb59b8af7007b213836..01d88fc84bde69b127c4220131322a680567f3d4 100644 (file)
@@ -1,3 +1,12 @@
+2010-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backport from mainline
+       2010-12-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/46753
+       * trans-openmp.c (gfc_trans_omp_do): Use build2_loc instead of
+       fold_build2_loc for OMP_FOR conditions.
+
 2010-11-25  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/46638
index de24f0fcd307505835fcaa43b918ef8593048109..8248e45a0d2c128ad5cadfe79f652b7883d88821 100644 (file)
@@ -1240,8 +1240,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
       if (simple)
        {
          TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, dovar, from);
-         TREE_VEC_ELT (cond, i) = fold_build2 (simple > 0 ? LE_EXPR : GE_EXPR,
-                                               boolean_type_node, dovar, to);
+         /* The condition should not be folded.  */
+         TREE_VEC_ELT (cond, i) = build2 (simple > 0 ? LE_EXPR : GE_EXPR,
+                                          boolean_type_node, dovar, to);
          TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, dovar, step);
          TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type, dovar,
                                                TREE_VEC_ELT (incr, i));
@@ -1262,8 +1263,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
          count = gfc_create_var (type, "count");
          TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, count,
                                             build_int_cst (type, 0));
-         TREE_VEC_ELT (cond, i) = fold_build2 (LT_EXPR, boolean_type_node,
-                                               count, tmp);
+         /* The condition should not be folded.  */
+         TREE_VEC_ELT (cond, i) = build2 (LT_EXPR, boolean_type_node,
+                                          count, tmp);
          TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, count,
                                                build_int_cst (type, 1));
          TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type,
index fbe141a4dd401b051b5d9addcab074b5058a3879..10c882b2e1fa9032a0831c9313ee5d3845af5299 100644 (file)
@@ -3,6 +3,9 @@
        Backport from mainline
        2010-12-02  Jakub Jelinek  <jakub@redhat.com>
 
+       PR fortran/46753
+       * libgomp.fortran/pr46753.f90: New test.
+
        PR libgomp/45240
        * parallel.c (GOMP_parallel_end): Unlock gomp_remaining_threads_lock
        at the end if sync builtins aren't supported.
diff --git a/libgomp/testsuite/libgomp.fortran/pr46753.f90 b/libgomp/testsuite/libgomp.fortran/pr46753.f90
new file mode 100644 (file)
index 0000000..f4833ab
--- /dev/null
@@ -0,0 +1,17 @@
+! PR fortran/46753
+! { dg-do run }
+
+  integer :: i, j
+  j = 0
+!$omp parallel do reduction(+:j)
+  do i = 2147483636, 2147483646
+    j = j + 1
+  end do
+  if (j.ne.11) call abort
+  j = 0
+!$omp parallel do reduction(+:j)
+  do i = -2147483637, -2147483647, -1
+    j = j + 1
+  end do
+  if (j.ne.11) call abort
+end