aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2021-02-11 13:24:50 +0000
committerPaul Thomas <pault@gcc.gnu.org>2021-02-11 13:25:04 +0000
commitff6903288d96aa1d28ae4912b1270985475f3ba8 (patch)
treee881839a198422bcdc2c84c10fc9fdc0188a7689 /gcc/fortran/match.c
parent22a6d99d0a0d383856440ea479b4a9edabf23961 (diff)
downloadgcc-ff6903288d96aa1d28ae4912b1270985475f3ba8.zip
gcc-ff6903288d96aa1d28ae4912b1270985475f3ba8.tar.gz
gcc-ff6903288d96aa1d28ae4912b1270985475f3ba8.tar.bz2
Fortran: Fix calls to associate name typebound subroutines [PR98897].
2021-02-11 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/98897 * match.c (gfc_match_call): Include associate names as possible entities with typebound subroutines. The target needs to be resolved for the type. gcc/testsuite/ PR fortran/98897 * gfortran.dg/typebound_call_32.f90: New test.
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index f0469e2..2df6191d 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -4999,10 +4999,16 @@ gfc_match_call (void)
sym = st->n.sym;
/* If this is a variable of derived-type, it probably starts a type-bound
- procedure call. */
- if ((sym->attr.flavor != FL_PROCEDURE
- || gfc_is_function_return_value (sym, gfc_current_ns))
- && (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS))
+ procedure call. Associate variable targets have to be resolved for the
+ target type. */
+ if (((sym->attr.flavor != FL_PROCEDURE
+ || gfc_is_function_return_value (sym, gfc_current_ns))
+ && (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS))
+ ||
+ (sym->assoc && sym->assoc->target
+ && gfc_resolve_expr (sym->assoc->target)
+ && (sym->assoc->target->ts.type == BT_DERIVED
+ || sym->assoc->target->ts.type == BT_CLASS)))
return match_typebound_call (st);
/* If it does not seem to be callable (include functions so that the