diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 25658d7..21e5be2 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2055,10 +2055,21 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, && gfc_get_default_type (sym->name, sym->ns)->type == BT_DERIVED) gfc_set_default_type (sym, 0, sym->ns); + /* Before throwing an error try resolving the target expression of + associate names. This should resolve function calls, for example. */ if (sym->ts.type == BT_UNKNOWN && m == MATCH_YES) { - gfc_error ("Symbol %qs at %C has no IMPLICIT type", sym->name); - return MATCH_ERROR; + if (sym->assoc && sym->assoc->target) + { + gfc_resolve_expr (sym->assoc->target); + sym->ts = sym->assoc->target->ts; + } + + if (sym->ts.type == BT_UNKNOWN) + { + gfc_error ("Symbol %qs at %C has no IMPLICIT type", sym->name); + return MATCH_ERROR; + } } else if ((sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS) && m == MATCH_YES) |