aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2007-03-08 13:30:58 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2007-03-08 13:30:58 +0100
commitac497e6a6e1ea5232c801338a34a41ae30555650 (patch)
treec34e8f381f0fe1211440c2a6c4cf7f60681e5e1c /gcc/fortran
parent9eaa999637696850a541a2eab736ea83690d32b3 (diff)
downloadgcc-ac497e6a6e1ea5232c801338a34a41ae30555650.zip
gcc-ac497e6a6e1ea5232c801338a34a41ae30555650.tar.gz
gcc-ac497e6a6e1ea5232c801338a34a41ae30555650.tar.bz2
re PR fortran/30973 ([4.1, 4.2 only] undetected name conflict: variables may be named like modules)
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. From-SVN: r122696
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog19
-rw-r--r--gcc/fortran/module.c11
2 files changed, 24 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 987bc50..3580963 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,9 +1,16 @@
-2007-03-08 Paul Thomas <pault@gcc.gnu.org>
-
- PR fortran/31011
- * expr.c (find_array_section): Correct arithmetic for section
- size.
-
+2007-07-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 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/31011
+ * expr.c (find_array_section): Correct arithmetic for section
+ size.
+
2007-03-07 Brooks Moses <brooks.moses@codesourcery.com>
* iresolve.c (gfc_resolve_ishftc): Correct s_kind value.
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index efb27e3..fcae6bd 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. */