diff options
author | mikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-02-08 14:18:16 +0000 |
---|---|---|
committer | mikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-02-08 14:18:16 +0000 |
commit | 135f23d5d08f2ce5ceb7129d74a256942ac5ac35 (patch) | |
tree | f3bddb2a80d9a83b808717fa412d39ff35b939d5 /gcc/fortran/module.c | |
parent | 8ae2b3a81ff0341462eb1f4c1f94e6406cb448ec (diff) |
Use the local name instead of the original name in the check for name conflicts
between a hosting program unit and use-associated symbols
in that program unit.
fortran/
PR fortran/63744
* module.c (check_for_ambiguous): Change argument type
from gfc_symbol to gfc_symtree. Check local (symtree) name
instead of original (symbol) name.
(read_module): Update caller.
testsuite/
PR fortran/63744
gfortran.dg/use_rename_8.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220515 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index df612ae953a5..b12f8247a917 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4795,19 +4795,21 @@ read_cleanup (pointer_info *p) /* It is not quite enough to check for ambiguity in the symbols by the loaded symbol and the new symbol not being identical. */ static bool -check_for_ambiguous (gfc_symbol *st_sym, pointer_info *info) +check_for_ambiguous (gfc_symtree *st, pointer_info *info) { gfc_symbol *rsym; module_locus locus; symbol_attribute attr; + gfc_symbol *st_sym; - if (gfc_current_ns->proc_name && st_sym->name == gfc_current_ns->proc_name->name) + if (gfc_current_ns->proc_name && st->name == gfc_current_ns->proc_name->name) { gfc_error ("%qs of module %qs, imported at %C, is also the name of the " - "current program unit", st_sym->name, module_name); + "current program unit", st->name, module_name); return true; } + st_sym = st->n.sym; rsym = info->u.rsym.sym; if (st_sym == rsym) return false; @@ -5037,7 +5039,7 @@ read_module (void) if (st != NULL) { /* Check for ambiguous symbols. */ - if (check_for_ambiguous (st->n.sym, info)) + if (check_for_ambiguous (st, info)) st->ambiguous = 1; else info->u.rsym.symtree = st; |