From: Paul Thomas Date: Tue, 23 Jan 2018 19:13:10 +0000 (+0000) Subject: re PR fortran/83866 (ICE in gfc_release_symbol, at fortran/symbol.c:3087) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f59986b285e3dff07f847c5a680f6f9e0b9520f0;p=gcc.git re PR fortran/83866 (ICE in gfc_release_symbol, at fortran/symbol.c:3087) 2018-23-01 Paul Thomas PR fortran/83866 * decl.c (gfc_match_derived_decl): If eos not matched, recover and emit error about garbage after declaration. 2018-23-01 Paul Thomas PR fortran/83866 * gfortran.dg/pdt_29.f03 : New test. From-SVN: r256995 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f50d8a8b283..c477e96d5bd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-23-01 Paul Thomas + + PR fortran/83866 + * decl.c (gfc_match_derived_decl): If eos not matched, recover + and emit error about garbage after declaration. + 2018-23-01 Paul Thomas PR fortran/83898 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 710c6f7937e..7922eefbd63 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -9857,7 +9857,10 @@ gfc_match_derived_decl (void) gfc_error_recovery (); m = gfc_match_eos (); if (m != MATCH_YES) - return m; + { + gfc_error_recovery (); + gfc_error_now ("Garbage after PARAMETERIZED TYPE declaration at %C"); + } sym->attr.pdt_template = 1; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d6e6709077f..c52b2d96d4f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-23-01 Paul Thomas + + PR fortran/83866 + * gfortran.dg/pdt_29.f03 : New test. + 2018-23-01 Paul Thomas PR fortran/83898 diff --git a/gcc/testsuite/gfortran.dg/pdt_29.f03 b/gcc/testsuite/gfortran.dg/pdt_29.f03 new file mode 100644 index 00000000000..596cc1c48f1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_29.f03 @@ -0,0 +1,15 @@ +! { dg-do compile } +! +! Test the fix for PR83866.f90 +! +! Contributed by G Steinmetz +! +program p + type private + end type + type t + class(t), pointer :: a + end type + type extends(t) :: t2 ! { dg-error "Garbage after | does not have a component" } + end type +end