diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-27 20:47:28 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-27 20:47:28 +0000 |
commit | af29c1f0a98911f45dc135a5f74c2d713c2c02e8 (patch) | |
tree | 9d7bdaf4ce466133c4469aa04221cb3c9ad73d70 /gcc/fortran/decl.c | |
parent | fbe52fc93dde59b68aa1c6fb146b2fc1077410e2 (diff) | |
download | gcc-af29c1f0a98911f45dc135a5f74c2d713c2c02e8.tar.gz |
2006-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/27954
* decl.c (gfc_free_data_all): New function to free all data structures
after errors in DATA statements and declarations.
(top_var_list): Use new function.(top_val_list): Use new function.
(gfc_match_data_decl): Use new function.
* misc.c (gfc_typename): Fixed incorrect function name in error text.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118084 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 02dc38cc8bb..fbd2bbbe360 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -128,6 +128,21 @@ gfc_free_data (gfc_data * p) } +/* Free all data in a namespace. */ +static void +gfc_free_data_all (gfc_namespace * ns) +{ + gfc_data *d; + + for (;ns->data;) + { + d = ns->data->next; + gfc_free (ns->data); + ns->data = d; + } +} + + static match var_element (gfc_data_variable *); /* Match a list of variables terminated by an iterator and a right @@ -262,6 +277,7 @@ top_var_list (gfc_data * d) syntax: gfc_syntax_error (ST_DATA); + gfc_free_data_all (gfc_current_ns); return MATCH_ERROR; } @@ -374,6 +390,7 @@ top_val_list (gfc_data * data) syntax: gfc_syntax_error (ST_DATA); + gfc_free_data_all (gfc_current_ns); return MATCH_ERROR; } @@ -2368,6 +2385,8 @@ ok: gfc_error ("Syntax error in data declaration at %C"); m = MATCH_ERROR; + gfc_free_data_all (gfc_current_ns); + cleanup: gfc_free_array_spec (current_as); current_as = NULL; |