re PR fortran/32432 (SEGV/endless loop after: "ERROR: ... already is initialized")

2007-07-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/32432
	* gfortran.h: Change type of gfc_assign_data_value from void to try.
	* data.c (gfc_assign_data_value): Return FAILURE if error found.
	* resolve.c (check_data_variable): If gfc_assign_data_value returns
	failure, break out of loop and return failure.

From-SVN: r126282
This commit is contained in:
Jerry DeLisle 2007-07-03 22:14:55 +00:00
parent f9faf95474
commit a24668a34f
3 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2007-07-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/32432
* gfortran.h: Change type of gfc_assign_data_value from void to try.
* data.c (gfc_assign_data_value): Return FAILURE if error found.
* resolve.c (check_data_variable): If gfc_assign_data_value returns
failure, break out of loop and return failure.
2007-07-03 Christopher D. Rickett <crickett@lanl.gov>
PR fortran/32579

View File

@ -245,7 +245,7 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts,
LVALUE already has an initialization, we extend this, otherwise we
create a new one. */
void
try
gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
{
gfc_ref *ref;
@ -293,8 +293,7 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
gfc_error ("'%s' at %L already is initialized at %L",
lvalue->symtree->n.sym->name, &lvalue->where,
&init->where);
gfc_free_expr (init);
init = NULL;
return FAILURE;
}
if (init == NULL)
@ -423,6 +422,8 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
symbol->value = expr;
else
last_con->expr = expr;
return SUCCESS;
}

View File

@ -7472,7 +7472,9 @@ check_data_variable (gfc_data_variable *var, locus *where)
values.left -= 1;
mpz_sub_ui (size, size, 1);
gfc_assign_data_value (var->expr, values.vnode->expr, offset);
t = gfc_assign_data_value (var->expr, values.vnode->expr, offset);
if (t == FAILURE)
break;
if (mark == AR_FULL)
mpz_add_ui (offset, offset, 1);