aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-09-17 18:24:37 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-09-17 18:24:37 +0000
commit62d3c075d52f1b92481bd0cdb9b0ef242210f512 (patch)
tree958630e32be5d6d40ebd26e96c747264a7f7378f /gcc/fortran/primary.c
parent7ac3ed134b4ad4a0e82ed1acc062e694128f103b (diff)
downloadgcc-62d3c075d52f1b92481bd0cdb9b0ef242210f512.zip
gcc-62d3c075d52f1b92481bd0cdb9b0ef242210f512.tar.gz
gcc-62d3c075d52f1b92481bd0cdb9b0ef242210f512.tar.bz2
re PR fortran/82173 ([meta-bug] Parameterized derived type errors)
2017-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/82173 * decl.c (gfc_get_pdt_instance): Use the component initializer expression for the default, rather than the parameter value. * resolve.c (resolve_pdt): New function. (resolve_symbol): Call it. Remove false error, prohibiting deferred type parameters for dummy arguments. PR fortran/60483 * primary.c (gfc_match_varspec): If the type of an associate name is unknown and yet there is a match, try resolving the target expression and using its type. 2017-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/82173 * gfortran.dg/pdt_1.f03 : Eliminate spurious error checks. * gfortran.dg/pdt_2.f03 : The same. * gfortran.dg/pdt_3.f03 : The same. * gfortran.dg/pdt_4.f03 : Add 'modtype' and two new errors in module 'bad_vars'. Add error concerning assumed parameters and save attribute. * gfortran.dg/pdt_11.f03 : New test. PR fortran/60483 * gfortran.dg/associate_9.f90 : Remove XFAIL and change to run. * gfortran.dg/associate_25.f90 : New test. * gfortran.dg/pdt_12.f03 : New test. From-SVN: r252894
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c15
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)