diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index f6b1635..8f85873 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2561,8 +2561,18 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag) break; case FL_PROCEDURE: - /* Check for a nonrecursive function result */ - if (sym->attr.function && sym->result == sym && !sym->attr.external) + /* Check for a nonrecursive function result variable. */ + if (sym->attr.function + && !sym->attr.external + && sym->result == sym + && ((sym == gfc_current_ns->proc_name + && sym == gfc_current_ns->proc_name->result) + || (gfc_current_ns->parent + && sym == gfc_current_ns->parent->proc_name->result) + || (sym->attr.entry + && sym->ns == gfc_current_ns) + || (sym->attr.entry + && sym->ns == gfc_current_ns->parent))) { /* If a function result is a derived type, then the derived type may still have to be resolved. */ |