diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2017-10-21 09:02:17 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2017-10-21 09:02:17 +0000 |
commit | de624beeae1b049b6bd834b28980e6ce9891d45d (patch) | |
tree | 63f51314f4655c12f86d5ba76dd5853289bad244 /gcc/fortran/decl.c | |
parent | aa93ca090e54442af1f2494ae6f6b07bd3c65630 (diff) | |
download | gcc-de624beeae1b049b6bd834b28980e6ce9891d45d.zip gcc-de624beeae1b049b6bd834b28980e6ce9891d45d.tar.gz gcc-de624beeae1b049b6bd834b28980e6ce9891d45d.tar.bz2 |
re PR fortran/82586 ([PDT] ICE: write_symbol(): bad module symbol)
2017-10-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82586
* decl.c (gfc_get_pdt_instance): Remove the error message that
the parameter does not have a corresponding component since
this is now taken care of when the derived type is resolved. Go
straight to error return instead.
(gfc_match_formal_arglist): Make the PDT relevant errors
immediate so that parsing of the derived type can continue.
(gfc_match_derived_decl): Do not check the match status on
return from gfc_match_formal_arglist for the same reason.
* resolve.c (resolve_fl_derived0): Check that each type
parameter has a corresponding component.
PR fortran/82587
* resolve.c (resolve_generic_f): Check that the derived type
can be used before resolving the struture constructor.
PR fortran/82589
* symbol.c (check_conflict): Add the conflicts involving PDT
KIND and LEN attributes.
2017-10-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82586
* gfortran.dg/pdt_16.f03 : New test.
* gfortran.dg/pdt_4.f03 : Catch the changed messages.
* gfortran.dg/pdt_8.f03 : Ditto.
PR fortran/82587
* gfortran.dg/pdt_17.f03 : New test.
PR fortran/82589
* gfortran.dg/pdt_18.f03 : New test.
From-SVN: r253970
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 5bf56c4..1a2d8f0 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -3242,13 +3242,10 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, param = type_param_name_list->sym; c1 = gfc_find_component (pdt, param->name, false, true, NULL); + /* An error should already have been thrown in resolve.c + (resolve_fl_derived0). */ if (!pdt->attr.use_assoc && !c1) - { - gfc_error ("The type parameter name list at %L contains a parameter " - "'%qs' , which is not declared as a component of the type", - &pdt->declared_at, param->name); - goto error_return; - } + goto error_return; kind_expr = NULL; if (!name_seen) @@ -5984,7 +5981,7 @@ gfc_match_formal_arglist (gfc_symbol *progname, int st_flag, /* The name of a program unit can be in a different namespace, so check for it explicitly. After the statement is accepted, the name is checked for especially in gfc_get_symbol(). */ - if (gfc_new_block != NULL && sym != NULL + if (gfc_new_block != NULL && sym != NULL && !typeparam && strcmp (sym->name, gfc_new_block->name) == 0) { gfc_error ("Name %qs at %C is the name of the procedure", @@ -5999,7 +5996,11 @@ gfc_match_formal_arglist (gfc_symbol *progname, int st_flag, m = gfc_match_char (','); if (m != MATCH_YES) { - gfc_error ("Unexpected junk in formal argument list at %C"); + if (typeparam) + gfc_error_now ("Expected parameter list in type declaration " + "at %C"); + else + gfc_error ("Unexpected junk in formal argument list at %C"); goto cleanup; } } @@ -6016,8 +6017,12 @@ ok: for (q = p->next; q; q = q->next) if (p->sym == q->sym) { - gfc_error ("Duplicate symbol %qs in formal argument list " - "at %C", p->sym->name); + if (typeparam) + gfc_error_now ("Duplicate name %qs in parameter " + "list at %C", p->sym->name); + else + gfc_error ("Duplicate symbol %qs in formal argument " + "list at %C", p->sym->name); m = MATCH_ERROR; goto cleanup; @@ -9814,9 +9819,9 @@ gfc_match_derived_decl (void) if (parameterized_type) { - m = gfc_match_formal_arglist (sym, 0, 0, true); - if (m != MATCH_YES) - return m; + /* Ignore error or mismatches to avoid the component declarations + causing problems later. */ + gfc_match_formal_arglist (sym, 0, 0, true); m = gfc_match_eos (); if (m != MATCH_YES) return m; |