From ece66526512d269375035e4413bb95d15a68ff3a Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Wed, 17 Oct 2018 07:16:16 +0000 Subject: re PR fortran/56386 ([F03] ICE with ASSOCIATE construct and an derived type array component) 2018-10-17 Paul Thomas PR fortran/56386 PR fortran/58906 PR fortran/77385 PR fortran/80260 PR fortran/82077 * resolve.c (resolve_variable): Fix up expressions with array associate names, where the parser did not detect that this is array and there was no array part_ref in the expression. 2018-10-17 Paul Thomas PR fortran/56386 PR fortran/58906 PR fortran/77385 * gfortran.dg/associate_44.f90 : New test. PR fortran/80260 * gfortran.dg/select_type_45.f90 : New test. PR fortran/82077 * gfortran.dg/select_type_46.f90 : New test. From-SVN: r265232 --- gcc/fortran/resolve.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gcc/fortran/resolve.c') 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) -- cgit v1.1