aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2019-03-13 20:52:23 +0100
committerJanus Weil <janus@gcc.gnu.org>2019-03-13 20:52:23 +0100
commit84083a711ee6b84f42a6d33c45784d660cf4f514 (patch)
treeeb0549546cb336b5c75457cd64c13649bebc9a5a
parentcbfa3ec327c44491ec9c141c6476ba1d6df639e9 (diff)
downloadgcc-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
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/decl.c14
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_16.f031
-rw-r--r--gcc/testsuite/gfortran.dg/pdt_30.f9017
5 files changed, 42 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ee39ad8..281c29f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+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 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/66695
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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0abb39b..afb61b4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2019-03-13 Marek Polacek <polacek@redhat.com>
PR c++/88979 - further P0634 fix for constructors.
diff --git a/gcc/testsuite/gfortran.dg/pdt_16.f03 b/gcc/testsuite/gfortran.dg/pdt_16.f03
index 067d87d..22c6b83 100644
--- a/gcc/testsuite/gfortran.dg/pdt_16.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_16.f03
@@ -12,7 +12,6 @@ end
program p
type t(a ! { dg-error "Expected parameter list" }
integer, kind :: a
- real(a) :: x
end type
type u(a, a) ! { dg-error "Duplicate name" }
integer, kind :: a ! { dg-error "already declared" }
diff --git a/gcc/testsuite/gfortran.dg/pdt_30.f90 b/gcc/testsuite/gfortran.dg/pdt_30.f90
new file mode 100644
index 0000000..47f7c77
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_30.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR 89601: [8/9 Regression] [PDT] ICE: Segmentation fault (in resolve_component)
+!
+! Contributed by Arseny Solokha <asolokha@gmx.com>
+
+program vw
+ interface
+ real function ul (ki)
+ real :: ki
+ end function ul
+ end interface
+ type :: q8 () ! { dg-error "A type parameter list is required" }
+ procedure (ul), pointer, nopass :: pj
+ end type q8
+ type (q8) :: ki
+end program vw