aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b6980a6..26175e4 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9476,6 +9476,7 @@ apply_default_init (gfc_symbol *sym)
return;
build_init_assign (sym, init);
+ sym->attr.referenced = 1;
}
/* Build an initializer for a local integer, real, complex, logical, or
@@ -12148,7 +12149,6 @@ resolve_symbol (gfc_symbol *sym)
described in 14.7.5, to those variables that have not already
been assigned one. */
if (sym->ts.type == BT_DERIVED
- && sym->attr.referenced
&& sym->ns == gfc_current_ns
&& !sym->value
&& !sym->attr.allocatable
@@ -12158,6 +12158,7 @@ resolve_symbol (gfc_symbol *sym)
if ((!a->save && !a->dummy && !a->pointer
&& !a->in_common && !a->use_assoc
+ && (a->referenced || a->result)
&& !(a->function && sym != sym->result))
|| (a->dummy && a->intent == INTENT_OUT && !a->pointer))
apply_default_init (sym);
@@ -12166,10 +12167,7 @@ resolve_symbol (gfc_symbol *sym)
if (sym->ts.type == BT_CLASS && sym->ns == gfc_current_ns
&& sym->attr.dummy && sym->attr.intent == INTENT_OUT
&& !sym->attr.pointer && !sym->attr.allocatable)
- {
- apply_default_init (sym);
- gfc_set_sym_referenced (sym);
- }
+ apply_default_init (sym);
/* If this symbol has a type-spec, check it. */
if (sym->attr.flavor == FL_VARIABLE || sym->attr.flavor == FL_PARAMETER