aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2021-01-07 17:34:49 +0000
committerPaul Thomas <pault@gcc.gnu.org>2021-01-07 17:34:49 +0000
commit85fb1d7d5f44a81a52015d58ebe67765faabfd35 (patch)
tree92304526acf7b36f8d0cdcdac67c8606c2bb4d3f /gcc/fortran/resolve.c
parentdddea6d4d81cac76ff64cde178e2d5f7fe09fb55 (diff)
downloadgcc-85fb1d7d5f44a81a52015d58ebe67765faabfd35.zip
gcc-85fb1d7d5f44a81a52015d58ebe67765faabfd35.tar.gz
gcc-85fb1d7d5f44a81a52015d58ebe67765faabfd35.tar.bz2
Fortran: Improve resolution of associate variables. [PR93701].
2021-01-07 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/93701 * resolve.c (find_array_spec): Put static prototype for resolve_assoc_var before this function and call for associate variables. gcc/testsuite/ PR fortran/93701 * gfortran.dg/associate_54.f90: New test. * gfortran.dg/associate_55.f90: New test. * gfortran.dg/associate_56.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 1fac183..f243bd1 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -4885,6 +4885,8 @@ gfc_resolve_dim_arg (gfc_expr *dim)
base symbol. We traverse the list of reference structures, setting
the stored reference to references. Component references can
provide an additional array specification. */
+static void
+resolve_assoc_var (gfc_symbol* sym, bool resolve_target);
static void
find_array_spec (gfc_expr *e)
@@ -4894,6 +4896,13 @@ find_array_spec (gfc_expr *e)
gfc_ref *ref;
bool class_as = false;
+ if (e->symtree->n.sym->assoc)
+ {
+ if (e->symtree->n.sym->assoc->target)
+ gfc_resolve_expr (e->symtree->n.sym->assoc->target);
+ resolve_assoc_var (e->symtree->n.sym, false);
+ }
+
if (e->symtree->n.sym->ts.type == BT_CLASS)
{
as = CLASS_DATA (e->symtree->n.sym)->as;