diff options
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/data.c | 7 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 51fcdf9c49f..2fe400ca13a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c index 35213a8fdb3..3c86bc860d4 100644 --- a/gcc/fortran/data.c +++ b/gcc/fortran/data.c @@ -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; } diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 615d85e756b..158abe02327 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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); |