From f9f98e59a7f6663f31b671c44998190079097f97 Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Thu, 7 May 2020 08:29:14 +0100 Subject: Fortran : ICE in gfc_conv_array_constructor_expr PR93497 Invalid expressions, such as those involving array constructors, used for the length of character types will cause an ICE. 2020-05-13 Steven G. Kargl gcc/fortran/ PR fortran/93497 * decl.c (char_len_param_value): Check whether character length expression is of type EXPR_OP and if so simplify it. * resolve.c (resolve_charlen): Reject length if it has a rank. 2020-05-13 Mark Eggleston gcc/testsuite/ PR fortran/93497 * gfortran.dg/pr88025.f90: Change in wording of error. * gfortran.dg/pr93497.f90: New test. * gfortran.dg/pr93714_1.f90: Change in wording of errors. * gfortran.dg/pr93714_2.f90: Change in wording of errors. --- gcc/fortran/resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fortran/resolve.c') diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 88ba88d..f6e10ea 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12358,7 +12358,7 @@ resolve_charlen (gfc_charlen *cl) } /* cl->length has been resolved. It should have an integer type. */ - if (cl->length->ts.type != BT_INTEGER) + if (cl->length->ts.type != BT_INTEGER || cl->length->rank != 0) { gfc_error ("Scalar INTEGER expression expected at %L", &cl->length->where); -- cgit v1.1