diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 3ef8d4e..76eed6b 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1324,11 +1324,27 @@ match_actual_arg (gfc_expr ** result) /* If the symbol is a function with itself as the result and is being defined, then we have a variable. */ - if (sym->result == sym - && (gfc_current_ns->proc_name == sym + if (sym->attr.function && sym->result == sym) + { + if (gfc_current_ns->proc_name == sym || (gfc_current_ns->parent != NULL - && gfc_current_ns->parent->proc_name == sym))) - break; + && gfc_current_ns->parent->proc_name == sym)) + break; + + if (sym->attr.entry + && (sym->ns == gfc_current_ns + || sym->ns == gfc_current_ns->parent)) + { + gfc_entry_list *el = NULL; + + for (el = sym->ns->entries; el; el = el->next) + if (sym == el->sym) + break; + + if (el) + break; + } + } } e = gfc_get_expr (); /* Leave it unknown for now */ |