re PR fortran/83866 (ICE in gfc_release_symbol, at fortran/symbol.c:3087)
authorPaul Thomas <pault@gcc.gnu.org>
Tue, 23 Jan 2018 19:13:10 +0000 (19:13 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Tue, 23 Jan 2018 19:13:10 +0000 (19:13 +0000)
2018-23-01  Paul Thomas  <pault@gcc.gnu.org>

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  <pault@gcc.gnu.org>

PR fortran/83866
* gfortran.dg/pdt_29.f03 : New test.

From-SVN: r256995

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pdt_29.f03 [new file with mode: 0644]

index f50d8a8b283696f2857275d1f6c87f6ef6066d6d..c477e96d5bd5f867d90b4dd776618ca371b12a50 100644 (file)
@@ -1,3 +1,9 @@
+2018-23-01  Paul Thomas  <pault@gcc.gnu.org>
+
+       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  <pault@gcc.gnu.org>
 
        PR fortran/83898
index 710c6f7937e7a60736bab5b2e697b5386481020d..7922eefbd631f30f6912e7676f017842fd13d46a 100644 (file)
@@ -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;
     }
 
index d6e6709077f8de078ef553323254644c60e4250a..c52b2d96d4f545e31cd84413b56e2a3359c2725a 100644 (file)
@@ -1,3 +1,8 @@
+2018-23-01  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/83866
+       * gfortran.dg/pdt_29.f03 : New test.
+
 2018-23-01  Paul Thomas  <pault@gcc.gnu.org>
 
        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 (file)
index 0000000..596cc1c
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do compile }
+!
+! Test the fix for PR83866.f90
+!
+! Contributed by G Steinmetz  <gscfq@t-online.de>
+!
+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