http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46849
--- Comment #6 from janus at gcc dot gnu.org 2010-12-14 12:13:04 UTC --- (In reply to comment #5) > > @@ -2717,7 +2717,7 @@ gfc_get_sym_tree (const char *name, gfc_namespace > > if (ns == NULL) > > - ns = gfc_current_ns; > > + ns = gfc_find_proc_namespace (gfc_current_ns); > > That looks wrong. gfc_get_sym_tree is called several times in decl.c, match.c, > parse.c and primary.c with NULL - I fear that this patch will cause symbols > end > up in the wrong name space. Yes, you're right. It produces a fair number of regressions ... > I think one should rather do something like the following - though one might > need to be a bit more careful and restrict it, e.g., to procedures. > > --- a/gcc/fortran/resolve.c > +++ b/gcc/fortran/resolve.c > @@ -11784,7 +11784,7 @@ resolve_symbol (gfc_symbol *sym) > for (ns = gfc_current_ns->parent; ns; ns = ns->parent) > { > symtree = gfc_find_symtree (ns->sym_root, sym->name); > - if (symtree && symtree->n.sym->generic) > + if (symtree) /* && symtree->n.sym->generic)*/ > { > this_symtree = gfc_find_symtree (gfc_current_ns->sym_root, > sym->name); I agree that this is better, though it still causes some regressions. I will now test the following variant: Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 167790) +++ gcc/fortran/resolve.c (working copy) @@ -11784,7 +11784,7 @@ resolve_symbol (gfc_symbol *sym) for (ns = gfc_current_ns->parent; ns; ns = ns->parent) { symtree = gfc_find_symtree (ns->sym_root, sym->name); - if (symtree && symtree->n.sym->generic) + if (symtree && symtree->n.sym->attr.flavor == FL_PROCEDURE) { this_symtree = gfc_find_symtree (gfc_current_ns->sym_root, sym->name);