+2006-09-09 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/28914
+ * trans-array.c (gfc_trans_array_constructor_value): Create a temporary
+ loop variable to hold the current loop variable in case it is modified
+ by the array constructor.
+
2006-09-07 Steven G. Kargl <kargls@comcast.net>
* gfortran.h (gfc_integer_info): Eliminate max_int.
tree exit_label;
tree loopbody;
tree tmp2;
+ tree tmp_loopvar;
loopbody = gfc_finish_block (&body);
gfc_add_block_to_block (pblock, &se.pre);
loopvar = se.expr;
+ /* Make a temporary, store the current value in that
+ and return it, once the loop is done. */
+ tmp_loopvar = gfc_create_var (TREE_TYPE (loopvar), "loopvar");
+ gfc_add_modify_expr (pblock, tmp_loopvar, loopvar);
+
/* Initialize the loop. */
gfc_init_se (&se, NULL);
gfc_conv_expr_val (&se, c->iterator->start);
/* Add the exit label. */
tmp = build1_v (LABEL_EXPR, exit_label);
gfc_add_expr_to_block (pblock, tmp);
+
+ /* Restore the original value of the loop counter. */
+ gfc_add_modify_expr (pblock, loopvar, tmp_loopvar);
}
}
mpz_clear (size);