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  <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
This commit is contained in:
Jakub Jelinek 2010-12-07 20:01:36 +01:00 committed by Jakub Jelinek
parent 1206840905
commit 059673f857
4 changed files with 35 additions and 4 deletions

View 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

View 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,

View 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.

View File

@ -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