* [PATCH] Fortran : ICE in gfc_validate_kind PR95586
@ 2020-06-17 6:36 Mark Eggleston
2020-06-20 10:05 ` Thomas Koenig
0 siblings, 1 reply; 2+ messages in thread
From: Mark Eggleston @ 2020-06-17 6:36 UTC (permalink / raw)
To: gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 786 bytes --]
Please find attached fix for PR95586.
OK to commit and backport?
Proposed commit message:
Fortran : ICE in gfc_validate_kind PR95586
Report syntax error for invalid letter-spec in IMPLICIT statements
for derived types and not an ICE.
Original patch by Steve Kargl. Added test cases based on those
provided by G. Steinmetz in the PR.
2020-06-17 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95586
* dec.l (gfc_match_implicit): Only perform else branch if
the type spect is not BT_DERIVED.
2020-06-17 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95586
* gfortran.dg/pr95586_1.f90: New test.
* gfortran.dg/pr95586_2.f90: New test.
--
https://www.codethink.co.uk/privacy.html
[-- Attachment #2: 0001-Fortran-ICE-in-gfc_validate_kind-PR95586.patch --]
[-- Type: text/x-patch, Size: 2311 bytes --]
From aefef0f66763aa436ce30f046cccf1ac41285954 Mon Sep 17 00:00:00 2001
From: Mark Eggleston <markeggleston@gcc.gnu.org>
Date: Wed, 10 Jun 2020 16:18:23 +0100
Subject: [PATCH] Fortran : ICE in gfc_validate_kind PR95586
Report syntax error for invalid letter-spec in IMPLICIT statements
for derived types and not an ICE.
Original patch by Steve Kargl. Added test cases based on those
provided by G. Steinmetz in the PR.
2020-06-17 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95586
* dec.l (gfc_match_implicit): Only perform else branch if
the type spect is not BT_DERIVED.
2020-06-17 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95586
* gfortran.dg/pr95586_1.f90: New test.
* gfortran.dg/pr95586_2.f90: New test.
---
gcc/fortran/decl.c | 2 +-
gcc/testsuite/gfortran.dg/pr95586_1.f90 | 9 +++++++++
gcc/testsuite/gfortran.dg/pr95586_2.f90 | 11 +++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gfortran.dg/pr95586_1.f90
create mode 100644 gcc/testsuite/gfortran.dg/pr95586_2.f90
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index c8a98537e87..c27cfacf2e4 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4827,7 +4827,7 @@ gfc_match_implicit (void)
/* Last chance -- check <TYPE> <SELECTOR> (<RANGE>). */
if (ts.type == BT_CHARACTER)
m = gfc_match_char_spec (&ts);
- else
+ else if (ts.type != BT_DERIVED)
{
m = gfc_match_kind_spec (&ts, false);
if (m == MATCH_NO)
diff --git a/gcc/testsuite/gfortran.dg/pr95586_1.f90 b/gcc/testsuite/gfortran.dg/pr95586_1.f90
new file mode 100644
index 00000000000..009eb3e88f0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95586_1.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+!
+
+program test
+ implicit type(t) (1) ! { dg-error "Syntax error" }
+ type t
+ end type
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/pr95586_2.f90 b/gcc/testsuite/gfortran.dg/pr95586_2.f90
new file mode 100644
index 00000000000..81ea6e9fa56
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95586_2.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+
+program test
+ integer, parameter :: n1 = 1
+ implicit type(t) (n1) ! { dg-error "Syntax error" }
+ type t
+ end type
+end program
+
+
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fortran : ICE in gfc_validate_kind PR95586
2020-06-17 6:36 [PATCH] Fortran : ICE in gfc_validate_kind PR95586 Mark Eggleston
@ 2020-06-20 10:05 ` Thomas Koenig
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Koenig @ 2020-06-20 10:05 UTC (permalink / raw)
To: Mark Eggleston, gcc-patches, fortran
Hi Mark,
> OK to commit
OK for master.
Since, according to the PR, this is not a regression and this
is an ICE on invalid, I don't think a backport is needed. On
the other hand, the patch is simple enough that I am quite
certain that it will not hurt.
So, I'll leave that up to you.
Best regards
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-20 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 6:36 [PATCH] Fortran : ICE in gfc_validate_kind PR95586 Mark Eggleston
2020-06-20 10:05 ` Thomas Koenig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).