diff options
author | Janus Weil <janus@gcc.gnu.org> | 2019-03-13 20:52:23 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2019-03-13 20:52:23 +0100 |
commit | 84083a711ee6b84f42a6d33c45784d660cf4f514 (patch) | |
tree | eb0549546cb336b5c75457cd64c13649bebc9a5a /gcc/fortran/decl.c | |
parent | cbfa3ec327c44491ec9c141c6476ba1d6df639e9 (diff) | |
download | gcc-84083a711ee6b84f42a6d33c45784d660cf4f514.zip gcc-84083a711ee6b84f42a6d33c45784d660cf4f514.tar.gz gcc-84083a711ee6b84f42a6d33c45784d660cf4f514.tar.bz2 |
re PR fortran/89601 ([PDT] ICE: Segmentation fault (in resolve_component))
fix PR 89601
2019-03-13 Janus Weil <janus@gcc.gnu.org>
PR fortran/89601
* decl.c (gfc_match_formal_arglist): Reject empty type parameter lists.
(gfc_match_derived_decl): Mark as PDT only if type parameter list was
matched successfully.
2019-03-13 Janus Weil <janus@gcc.gnu.org>
PR fortran/89601
* gfortran.dg/pdt_16.f03: Modified to avoid follow-up errors.
* gfortran.dg/pdt_30.f90: New test case.
From-SVN: r269658
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 2f335b2..749faf9 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -6275,7 +6275,16 @@ gfc_match_formal_arglist (gfc_symbol *progname, int st_flag, } if (gfc_match_char (')') == MATCH_YES) - goto ok; + { + if (typeparam) + { + gfc_error_now ("A type parameter list is required at %C"); + m = MATCH_ERROR; + goto cleanup; + } + else + goto ok; + } for (;;) { @@ -10217,13 +10226,14 @@ gfc_match_derived_decl (void) m = gfc_match_formal_arglist (sym, 0, 0, true); if (m != MATCH_YES) gfc_error_recovery (); + else + sym->attr.pdt_template = 1; m = gfc_match_eos (); if (m != MATCH_YES) { gfc_error_recovery (); gfc_error_now ("Garbage after PARAMETERIZED TYPE declaration at %C"); } - sym->attr.pdt_template = 1; } if (extended && !sym->components) |