[gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Fortran] ICE in gfc_typenode_for_spec PR93603
Jiu Fu Guo
guojiufu@gcc.gnu.org
Wed Mar 11 02:04:13 GMT 2020
https://gcc.gnu.org/g:8f55a0eec910dd02992f4caca083048d91c0b2e1
commit 8f55a0eec910dd02992f4caca083048d91c0b2e1
Author: Mark Eggleston <markeggleston@gcc.gnu.org>
Date: Tue Feb 18 12:23:20 2020 +0000
[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.
Diff:
---
gcc/fortran/ChangeLog | 7 +++++++
gcc/fortran/match.c | 8 ++++++++
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/gfortran.dg/pr93603.f90 | 7 +++++++
4 files changed, 27 insertions(+)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 302af3aa990..2e874b83c64 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2020-02-18 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.
+
2020-02-18 Steven G. Kargl <kargl@gcc.gnu.org>
Mark Eggleston <markeggleston@gcc.gnu.org>
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/ChangeLog b/gcc/testsuite/ChangeLog
index 1c7f879bf66..f9a545e2d93 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-18 Mark Eggleston <mark.eggleston@codethink.com>
+
+ PR fortran/93603
+ * gfortran.dg/pr93603.f90 : New test.
+
2020-02-20 Mark Eggleston <markeggleston@gcc.gnu.org>
PR fortran/93580
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
+
More information about the Gcc-cvs
mailing list