* [Regression, patch][Fortran] ICE in gfc_typenode_for_spec PR93603
@ 2020-02-17 13:17 Mark Eggleston
2020-02-17 22:06 ` Thomas Koenig
0 siblings, 1 reply; 2+ messages in thread
From: Mark Eggleston @ 2020-02-17 13:17 UTC (permalink / raw)
To: gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
Please find attached fix for PR fortran/93603.
gcc/fortran/ChangeLog
   Steven G. Kargl <kargl@gcc.gnu.org>
   PR fortran/93603
   * match.c (gfc_match_associate) : If target expression
   has the type BT_BOZ output an error and goto
   assocListError.
gcc/testsuite/ChangeLog
   Mark Eggleston <mark.eggleston@codethink.com>
   PR fortran/93603
   * gfortran.dg/pr93603.f90 : New test.
Tested using make with check-fortran on master at:
https://gcc.gnu.org/g:f82617f229b336d856c18313339b14657e05c129
OK to commit?
--
https://www.codethink.co.uk/privacy.html
[-- Attachment #2: 0001-Fortran-ICE-in-gfc_typenode_for_spec-PR93603.patch --]
[-- Type: text/x-patch, Size: 1966 bytes --]
From 42e66ff8910e995e6b8fb9bb597a09ec7be07def Mon Sep 17 00:00:00 2001
From: Mark Eggleston <markeggleston@gcc.gnu.org>
Date: Fri, 7 Feb 2020 11:39:37 +0000
Subject: [PATCH] [Fortran] ICE in gfc_typenode_for_spec PR93603
Associating a symbol with a BOZ constant caused an ICE. Output
an error message as an association target cannot be a BOZ
constant.
Original patch provided by Steven G. Kargl <kargl@gcc.gnu.org>.
gcc/fortran/ChangeLog
PR fortran/93603
* match.c (gfc_match_associate) : If target expression
has the type BT_BOZ output an error and goto
assocListError.
gcc/testsuite/ChangeLog
PR fortran/93603
* gfortran.dg/pr93603.f90 : New test.
---
gcc/fortran/match.c | 8 ++++++++
gcc/testsuite/gfortran.dg/pr93603.f90 | 7 +++++++
2 files changed, 15 insertions(+)
create mode 100644 gcc/testsuite/gfortran.dg/pr93603.f90
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index a74cb8c5c19..9c2ec41c49c 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1957,6 +1957,14 @@ gfc_match_associate (void)
goto assocListError;
}
+ /* The target expression cannot be a BOZ literal constant. */
+ if (newAssoc->target->ts.type == BT_BOZ)
+ {
+ gfc_error ("Association target at %L cannot be a BOZ literal "
+ "constant", &newAssoc->target->where);
+ goto assocListError;
+ }
+
/* The `variable' field is left blank for now; because the target is not
yet resolved, we can't use gfc_has_vector_subscript to determine it
for now. This is set during resolution. */
diff --git a/gcc/testsuite/gfortran.dg/pr93603.f90 b/gcc/testsuite/gfortran.dg/pr93603.f90
new file mode 100644
index 00000000000..fd452e52ca2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr93603.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+
+program p
+ associate (y => z'1') ! { dg-error "cannot be a BOZ literal constant" }
+ end associate ! { dg-error "Expecting END PROGRAM" }
+end
+
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Regression, patch][Fortran] ICE in gfc_typenode_for_spec PR93603
2020-02-17 13:17 [Regression, patch][Fortran] ICE in gfc_typenode_for_spec PR93603 Mark Eggleston
@ 2020-02-17 22:06 ` Thomas Koenig
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Koenig @ 2020-02-17 22:06 UTC (permalink / raw)
To: Mark Eggleston, gcc-patches, fortran
Hi Mark and Steve,
> OK to commit?
OK (bordering on obvious).
Thanks to both of you!
Regards
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-17 22:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 13:17 [Regression, patch][Fortran] ICE in gfc_typenode_for_spec PR93603 Mark Eggleston
2020-02-17 22:06 ` 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).