summaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-08 12:30:58 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-08 12:30:58 +0000
commit90da2477177993f3e6ff5a8794ea7d31ef9351ae (patch)
treec34e8f381f0fe1211440c2a6c4cf7f60681e5e1c /gcc/fortran/module.c
parentda5ce6539d638abb163ee04287fe0f3509a13cb2 (diff)
downloadgcc-90da2477177993f3e6ff5a8794ea7d31ef9351ae.tar.gz
2007-03-08 Tobias Burnus <burnus@net-b.de>
PR fortran/30973 * module.c (read_module): Always import module name as symbol. (gfc_match_use): Disallow module name in the only clause of a use statement. 2007-03-08 Tobias Burnus <burnus@net-b.de> PR fortran/30973 * gfortran.dg/use_4.f90: New test. * gfortran.dg/used_dummy_types_7.f90: Correct ambiguous symbol. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122696 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index efb27e33fd3..fcae6bd7d3f 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -619,6 +619,14 @@ gfc_match_use (void)
goto cleanup;
}
+ if (strcmp (new->use_name, module_name) == 0
+ || strcmp (new->local_name, module_name) == 0)
+ {
+ gfc_error ("The name '%s' at %C has already been used as "
+ "an external module name.", module_name);
+ goto cleanup;
+ }
+
break;
case INTERFACE_USER_OP:
@@ -3438,6 +3446,9 @@ read_module (void)
/* Get the jth local name for this symbol. */
p = find_use_name_n (name, &j);
+ if (p == NULL && strcmp (name, module_name) == 0)
+ p = name;
+
/* Skip symtree nodes not in an ONLY clause, unless there
is an existing symtree loaded from another USE
statement. */