if (simple)
{
TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, dovar, from);
- TREE_VEC_ELT (cond, i) = fold_build2_loc (input_location, simple > 0
- ? LE_EXPR : GE_EXPR,
- boolean_type_node, dovar,
- to);
+ /* The condition should not be folded. */
+ TREE_VEC_ELT (cond, i) = build2_loc (input_location, simple > 0
+ ? LE_EXPR : GE_EXPR,
+ boolean_type_node, dovar, to);
TREE_VEC_ELT (incr, i) = fold_build2_loc (input_location, PLUS_EXPR,
type, dovar, step);
TREE_VEC_ELT (incr, i) = fold_build2_loc (input_location,
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_loc (input_location, LT_EXPR,
- boolean_type_node,
- count, tmp);
+ /* The condition should not be folded. */
+ TREE_VEC_ELT (cond, i) = build2_loc (input_location, LT_EXPR,
+ boolean_type_node,
+ count, tmp);
TREE_VEC_ELT (incr, i) = fold_build2_loc (input_location, PLUS_EXPR,
type, count,
build_int_cst (type, 1));
--- /dev/null
+! 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