aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-10-21 09:02:17 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-10-21 09:02:17 +0000
commitde624beeae1b049b6bd834b28980e6ce9891d45d (patch)
tree63f51314f4655c12f86d5ba76dd5853289bad244 /gcc/fortran/resolve.c
parentaa93ca090e54442af1f2494ae6f6b07bd3c65630 (diff)
downloadgcc-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/resolve.c')
-rw-r--r--gcc/fortran/resolve.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 04d4e8a..5062bcb 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -2694,6 +2694,8 @@ generic:
if (!gfc_convert_to_structure_constructor (expr, intr->sym, NULL,
NULL, false))
return false;
+ if (!gfc_use_derived (expr->ts.u.derived))
+ return false;
return resolve_structure_cons (expr, 0);
}
@@ -13937,6 +13939,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
{
gfc_symbol* super_type;
gfc_component *c;
+ gfc_formal_arglist *f;
bool success;
if (sym->attr.unlimited_polymorphic)
@@ -13989,6 +13992,22 @@ resolve_fl_derived0 (gfc_symbol *sym)
&& !ensure_not_abstract (sym, super_type))
return false;
+ /* Check that there is a component for every PDT parameter. */
+ if (sym->attr.pdt_template)
+ {
+ for (f = sym->formal; f; f = f->next)
+ {
+ c = gfc_find_component (sym, f->sym->name, true, true, NULL);
+ if (c == NULL)
+ {
+ gfc_error ("Parameterized type %qs does not have a component "
+ "corresponding to parameter %qs at %L", sym->name,
+ f->sym->name, &sym->declared_at);
+ break;
+ }
+ }
+ }
+
/* Add derived type to the derived type list. */
add_dt_to_dt_list (sym);