aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-07-19 20:13:53 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-07-19 20:13:53 +0000
commit24d36d28c4519d1fe2d07b586a75b3957c5cccfb (patch)
tree2ed49e292053f65344151ace758bb01e4c5254ac /gcc/fortran/resolve.c
parent6a9a79a866b120d678d6463bcdb718fe87c8717f (diff)
downloadgcc-24d36d28c4519d1fe2d07b586a75b3957c5cccfb.zip
gcc-24d36d28c4519d1fe2d07b586a75b3957c5cccfb.tar.gz
gcc-24d36d28c4519d1fe2d07b586a75b3957c5cccfb.tar.bz2
re PR fortran/16940 (Failure to perform host association correctly)
2005-07-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/16940 * resolve.c (resolve_symbol): A symbol with FL_UNKNOWN is matched against interfaces in parent namespaces. If there the symtree is set to point to the interface. 2005-07-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/16940 * gfortran.dg/module_interface_1.f90: New test. From-SVN: r102167
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 1e4c931..ff2ac56 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -4031,9 +4031,34 @@ resolve_symbol (gfc_symbol * sym)
int i;
const char *whynot;
gfc_namelist *nl;
+ gfc_symtree * symtree;
+ gfc_symtree * this_symtree;
+ gfc_namespace * ns;
if (sym->attr.flavor == FL_UNKNOWN)
{
+
+ /* If we find that a flavorless 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 symbol. */
+ 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);
+ sym->refs--;
+ if (!sym->refs)
+ gfc_free_symbol (sym);
+ symtree->n.sym->refs++;
+ this_symtree->n.sym = symtree->n.sym;
+ return;
+ }
+ }
+
+ /* Otherwise give it a flavor according to such attributes as
+ it has. */
if (sym->attr.external == 0 && sym->attr.intrinsic == 0)
sym->attr.flavor = FL_VARIABLE;
else