summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-03 22:14:55 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-03 22:14:55 +0000
commit2f427a5c5bf7828bdc4f42fa318ff6967d476358 (patch)
tree4352b8947dcf2586ceea4b93620531d88a0240f0 /gcc/fortran
parent990be1d528036444e6dae4a5ac44df5d3dbb5f85 (diff)
downloadgcc-2f427a5c5bf7828bdc4f42fa318ff6967d476358.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126282 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/data.c7
-rw-r--r--gcc/fortran/resolve.c4
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);