re PR fortran/28914 (Code inside loop hangs; outside loop runs normally; runs OK on other compilers)

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.

From-SVN: r116808
This commit is contained in:
Paul Thomas 2006-09-10 04:53:18 +00:00 committed by Jerry DeLisle
parent 66cc73628c
commit bfa7a1e994
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -1252,6 +1252,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
tree exit_label;
tree loopbody;
tree tmp2;
tree tmp_loopvar;
loopbody = gfc_finish_block (&body);
@ -1260,6 +1261,11 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
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);
@ -1327,6 +1333,9 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
/* 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);