[gfortran] Fix PR13910: old-style variable initialization with gfortran
Paul Brook
paul@codesourcery.com
Sun Aug 29 19:11:00 GMT 2004
On Sunday 29 August 2004 16:23, Tobias Schlüter wrote:
> 2004-08-29 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
>
> * decl.c (free_variable, free_value, gfc_free_data, var_list,
> var_element, top_var_list, match_data_constant, top_val_list,
> gfc_match_data): Move here from match.c.
> (match_old_style_init): New function.
> (variable_decl): Match old-style initialization.
> * expr.c (gfc_get_variable_expr): New function.
> * gfortran.h (gfc_get_variable_expr): Add prototype.
> * gfortran.texi: Start documentation for supported extensions.
> * match.c: Remove the functions moved to decl.c.
> * match.h (gfc_match_data): Move prototype to under decl.c.
> * symbol.c (gfc_find_sym_tree, gfc_find_symbol): Add/correct
> comments.
Ok, except
> +static match
> +match_old_style_init (const char *name)
> +{
> + match m;
> + gfc_symtree *st;
> + gfc_data *newdata;
> +
> + /* Set up data structure to hold initializers. */
> + gfc_find_sym_tree (name, NULL, 0, &st);
> +
> + newdata = gfc_get_data ();
> + newdata->var = gfc_get_data_variable ();
> + newdata->var->expr = gfc_get_variable_expr (st);
> +
> + /* Match initial value list. This also eats the terminal
> + '/'. */
> + m = top_val_list (newdata);
> + if (m != MATCH_YES)
> + return m;
You need to free newdata if the match fails.
Paul
More information about the Gcc-patches
mailing list