aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 2f458c4..79c9510 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -9699,13 +9699,20 @@ gfc_match_submod_proc (void)
if (get_proc_name (name, &sym, false))
return MATCH_ERROR;
- /* Make sure that the result field is appropriately filled, even though
- the result symbol will be replaced later on. */
+ /* Make sure that the result field is appropriately filled. */
if (sym->tlink && sym->tlink->attr.function)
{
- if (sym->tlink->result
- && sym->tlink->result != sym->tlink)
- sym->result= sym->tlink->result;
+ if (sym->tlink->result && sym->tlink->result != sym->tlink)
+ {
+ sym->result = sym->tlink->result;
+ if (!sym->result->attr.use_assoc)
+ {
+ gfc_symtree *st = gfc_new_symtree (&gfc_current_ns->sym_root,
+ sym->result->name);
+ st->n.sym = sym->result;
+ sym->result->refs++;
+ }
+ }
else
sym->result = sym;
}