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
This commit is contained in:
Asher Langton 2006-07-03 20:19:23 +00:00 committed by Asher Langton
parent 11fc427598
commit ed0e3607b2
4 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-07-03 Asher Langton <langton2@llnl.gov>
* decl.c (match_old_style_init): Add data attribute to symbol.
2006-07-03 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* iresolve.c (gfc_resolve_cpu_time, gfc_resolve_random_number):

View File

@ -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;

View File

@ -1,3 +1,7 @@
2006-07-03 Asher Langton <langton2@llnl.gov>
* gfortran.dg/oldstyle_2.f90: New.
2006-07-03 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/gnat.dg/string_slice.adb: New test.

View File

@ -0,0 +1,4 @@
! { dg-do compile}
subroutine foo(i) ! { dg-error "DATA attribute" }
integer i /10/
end subroutine foo