From ed0e3607b2a4fa5fbba08eafc2d8bb24ab593c95 Mon Sep 17 00:00:00 2001 From: Asher Langton Date: Mon, 3 Jul 2006 20:19:23 +0000 Subject: decl.c (match_old_style_init): Add data attribute to symbol. * decl.c (match_old_style_init): Add data attribute to symbol. * gfortran.dg/oldstyle_2.f90: New. From-SVN: r115161 --- gcc/fortran/decl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/decl.c') diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index e8b1626..5eca35d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -385,11 +385,13 @@ match_old_style_init (const char *name) { match m; gfc_symtree *st; + gfc_symbol *sym; gfc_data *newdata; /* Set up data structure to hold initializers. */ gfc_find_sym_tree (name, NULL, 0, &st); - + sym = st->n.sym; + newdata = gfc_get_data (); newdata->var = gfc_get_data_variable (); newdata->var->expr = gfc_get_variable_expr (st); @@ -410,6 +412,13 @@ match_old_style_init (const char *name) return MATCH_ERROR; } + /* Mark the variable as having appeared in a data statement. */ + if (gfc_add_data (&sym->attr, sym->name, &sym->declared_at) == FAILURE) + { + gfc_free (newdata); + return MATCH_ERROR; + } + /* Chain in namespace list of DATA initializers. */ newdata->next = gfc_current_ns->data; gfc_current_ns->data = newdata; -- cgit v1.1