From: Jakub Jelinek Date: Tue, 7 Dec 2010 15:27:50 +0000 (+0100) Subject: backport: re PR fortran/46753 (ICE: OpenMP - in extract_omp_for_data, at omp-low... X-Git-Tag: releases/gcc-4.5.2~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39ff44ebe742ba61beef2a0f99361c60cf5c03d6;p=thirdparty%2Fgcc.git backport: re PR fortran/46753 (ICE: OpenMP - in extract_omp_for_data, at omp-low.c:335) Backport from mainline 2010-12-02 Jakub Jelinek 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: r167549 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e62fc16d0be7..774af8895c55 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2010-12-07 Jakub Jelinek + + Backport from mainline + 2010-12-02 Jakub Jelinek + + PR fortran/46753 + * trans-openmp.c (gfc_trans_omp_do): Use build2_loc instead of + fold_build2_loc for OMP_FOR conditions. + 2010-12-04 Daniel Kraft PR fortran/46794 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 51039ad90abd..0afe6d325b32 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1243,8 +1243,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)); @@ -1265,8 +1266,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, diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 861d6e008f25..26cd0be86773 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -3,6 +3,9 @@ Backport from mainline 2010-12-02 Jakub Jelinek + 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 index 000000000000..f4833abc845c --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr46753.f90 @@ -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