aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2018-10-17 07:16:16 +0000
committerPaul Thomas <pault@gcc.gnu.org>2018-10-17 07:16:16 +0000
commitece66526512d269375035e4413bb95d15a68ff3a (patch)
tree366c622d900d7358dd673354407e101e9cc05ef8 /gcc/fortran/resolve.c
parent17d6b74d7f557a86a87ce5c6e1abf448576efb8e (diff)
downloadgcc-ece66526512d269375035e4413bb95d15a68ff3a.zip
gcc-ece66526512d269375035e4413bb95d15a68ff3a.tar.gz
gcc-ece66526512d269375035e4413bb95d15a68ff3a.tar.bz2
re PR fortran/56386 ([F03] ICE with ASSOCIATE construct and an derived type array component)
2018-10-17 Paul Thomas <pault@gcc.gnu.org> 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 <pault@gcc.gnu.org> 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
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)