*** resolve.c.bak Thu Jun 30 11:57:22 2005 --- gcc-4.1-20050522/gcc/fortran/resolve.c Sun Jul 3 15:20:28 2005 *************** resolve_symbol (gfc_symbol * sym) *** 4031,4036 **** --- 4031,4062 ---- int i; const char *whynot; gfc_namelist *nl; + gfc_symtree * symtree; + gfc_symtree * this_symtree; + gfc_namespace * ns; + + /* If we find that the symbol is an interface in one of the + parent namespaces, find its symtree in this namespace, + free the symbol and set the symtree to point to the + interface; remembering to increment the references. */ + if (sym->ts.type == BT_UNKNOWN + && sym->attr.flavor == FL_UNKNOWN) + { + 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) + { + this_symtree = gfc_find_symtree + (gfc_current_ns->sym_root, + sym->name); + gfc_free_symbol (sym); + symtree->n.sym->refs++; + this_symtree->n.sym = symtree->n.sym; + return; + } + } + } if (sym->attr.flavor == FL_UNKNOWN) {