ICE occurs when assigning a BOZ constant to an class(*) variable
with the allocatable attribute. Use of BOZ constants outside
data statements and int/real/dble/cmplx intrinsics is not allowed.
Original patch provided by Steven G. Kargl <kargl@gcc.gnu.org>.
gcc/fortran/ChangeLog
PR fortran/93601
* match.c (gfc_match_assignment) : Reject assignment if
the lhs stype is BT_CLASS and the rhs type is BT_BOZ.
gcc/testsuite/ChangeLog
PR fortran/93601
* gfortran.dg/pr93601.f90 : New test.
+2020-02-18 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/93601
+ * match.c (gfc_match_assignment) : Reject assignment if
+ the lhs stype is BT_CLASS and the rhs type is BT_BOZ.
+
2020-02-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/93603
rvalue = NULL;
m = gfc_match (" %e%t", &rvalue);
+ if (m == MATCH_YES
+ && rvalue->ts.type == BT_BOZ
+ && lvalue->ts.type == BT_CLASS)
+ {
+ m = MATCH_ERROR;
+ gfc_error ("BOZ literal constant at %L is neither a DATA statement "
+ "value nor an actual argument of INT/REAL/DBLE/CMPLX "
+ "intrinsic subprogram", &rvalue->where);
+ }
+
if (lvalue->expr_type == EXPR_CONSTANT)
{
/* This clobbers %len and %kind. */
+2020-02-18 Mark Eggleston <mark.eggleston@codethink.com>
+
+ PR fortran/93601
+ * gfortran.dg/pr93601.f90 : New test.
+
2020-02-18 Martin Liska <mliska@suse.cz>
PR ipa/93583
--- /dev/null
+! { dg-do compile }
+
+program p
+ class(*), allocatable :: z
+ z = z'1' ! { dg-error "BOZ literal constant at" }
+end
+