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.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 56ab595..7c03816 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5436,6 +5436,24 @@ resolve_variable (gfc_expr *e)
gfc_fix_class_refs (e);
if (!sym->attr.dimension && e->ref && e->ref->type == REF_ARRAY)
return false;
+ else if (sym->attr.dimension && (!e->ref || e->ref->type != REF_ARRAY))
+ {
+ /* This can happen because the parser did not detect that the
+ associate name is an array and the expression had no array
+ part_ref. */
+ gfc_ref *ref = gfc_get_ref ();
+ ref->type = REF_ARRAY;
+ ref->u.ar = *gfc_get_array_ref();
+ ref->u.ar.type = AR_FULL;
+ if (sym->as)
+ {
+ ref->u.ar.as = sym->as;
+ ref->u.ar.dimen = sym->as->rank;
+ }
+ ref->next = e->ref;
+ e->ref = ref;
+
+ }
}
if (sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.generic)