aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>2005-06-21 20:48:20 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-06-21 20:48:20 +0000
commit15f9ce29807bd956147f285f76c0c3aaa7e17027 (patch)
tree408b055ad1a05d0a0b549c4c0ff9a1749c71a4e0 /gcc/fortran/module.c
parent2735e93e53bb4cf96a8f245b40bf29fefe946163 (diff)
downloadgcc-15f9ce29807bd956147f285f76c0c3aaa7e17027.zip
gcc-15f9ce29807bd956147f285f76c0c3aaa7e17027.tar.gz
gcc-15f9ce29807bd956147f285f76c0c3aaa7e17027.tar.bz2
namelist_use_1.msg
Co-Authored-By: Paul Thomas <pault@gcc.gnu.org> From-SVN: r101233
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 7aa91cb..b7e3d48 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -2564,6 +2564,55 @@ mio_expr (gfc_expr ** ep)
}
+/* Read and write namelists */
+
+static void
+mio_namelist (gfc_symbol * sym)
+{
+ gfc_namelist *n, *m;
+ const char *check_name;
+
+ mio_lparen ();
+
+ if (iomode == IO_OUTPUT)
+ {
+ for (n = sym->namelist; n; n = n->next)
+ mio_symbol_ref (&n->sym);
+ }
+ else
+ {
+ /* This departure from the standard is flagged as an error.
+ It does, in fact, work correctly. TODO: Allow it
+ conditionally? */
+ if (sym->attr.flavor == FL_NAMELIST)
+ {
+ check_name = find_use_name (sym->name);
+ if (check_name && strcmp (check_name, sym->name) != 0)
+ gfc_error("Namelist %s cannot be renamed by USE"
+ " association to %s.",
+ sym->name, check_name);
+ }
+
+ m = NULL;
+ while (peek_atom () != ATOM_RPAREN)
+ {
+ n = gfc_get_namelist ();
+ mio_symbol_ref (&n->sym);
+
+ if (sym->namelist == NULL)
+ sym->namelist = n;
+ else
+ m->next = n;
+
+ m = n;
+ }
+ sym->namelist_tail = m;
+ }
+
+ mio_rparen ();
+}
+
+
/* Save/restore lists of gfc_interface stuctures. When loading an
interface, we are really appending to the existing list of
interfaces. Checking for duplicate and ambiguous interfaces has to
@@ -2724,6 +2773,7 @@ mio_symbol (gfc_symbol * sym)
sym->component_access =
MIO_NAME(gfc_access) (sym->component_access, access_types);
+ mio_namelist (sym);
mio_rparen ();
}