diff options
author | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-02-18 14:15:41 +0000 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-02-18 14:15:41 +0000 |
commit | 23d3f25c87d307536f7e0f15e211968a87657602 (patch) | |
tree | f1a38ab5169c3ccb426df0042d1b9e2b8000a93a /gcc/fortran/match.c | |
parent | 08afe87b7976e93197a66e01f93191ead496ad42 (diff) | |
download | gcc-23d3f25c87d307536f7e0f15e211968a87657602.zip gcc-23d3f25c87d307536f7e0f15e211968a87657602.tar.gz gcc-23d3f25c87d307536f7e0f15e211968a87657602.tar.bz2 |
[Fortran] ICE: Invalid expression in gfc_element_size PR93601
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.
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r-- | gcc/fortran/match.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 9c2ec41..e4d5224 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1348,6 +1348,16 @@ gfc_match_assignment (void) 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. */ |