From ed0e3607b2a4fa5fbba08eafc2d8bb24ab593c95 Mon Sep 17 00:00:00 2001 From: Asher Langton Date: Mon, 3 Jul 2006 20:19:23 +0000 Subject: [PATCH] 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/ChangeLog | 4 ++++ gcc/fortran/decl.c | 11 ++++++++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/oldstyle_2.f90 | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/oldstyle_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b2926fc6cac..a340461c230 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2006-07-03 Asher Langton + + * decl.c (match_old_style_init): Add data attribute to symbol. + 2006-07-03 Francois-Xavier Coudert * iresolve.c (gfc_resolve_cpu_time, gfc_resolve_random_number): diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index e8b1626609a..5eca35d6c6a 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 05ae56b8a3e..80a328c21cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-07-03 Asher Langton + + * gfortran.dg/oldstyle_2.f90: New. + 2006-07-03 Eric Botcazou * gnat.dg/gnat.dg/string_slice.adb: New test. diff --git a/gcc/testsuite/gfortran.dg/oldstyle_2.f90 b/gcc/testsuite/gfortran.dg/oldstyle_2.f90 new file mode 100644 index 00000000000..6f1b477295b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/oldstyle_2.f90 @@ -0,0 +1,4 @@ +! { dg-do compile} +subroutine foo(i) ! { dg-error "DATA attribute" } + integer i /10/ +end subroutine foo -- 2.30.2