aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorMark Eggleston <markeggleston@gcc.gnu.org>2020-05-07 08:29:14 +0100
committerMark Eggleston <markeggleston@gcc.gnu.org>2020-05-13 14:51:53 +0100
commitf9f98e59a7f6663f31b671c44998190079097f97 (patch)
treec67bd2020046c78302df340b66465d15260407c2 /gcc/fortran/decl.c
parent6cc6b087c8cdfdf58a4bb166aa53950c4bfdef2d (diff)
downloadgcc-f9f98e59a7f6663f31b671c44998190079097f97.zip
gcc-f9f98e59a7f6663f31b671c44998190079097f97.tar.gz
gcc-f9f98e59a7f6663f31b671c44998190079097f97.tar.bz2
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 <kargl@gcc.gnu.org> 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 <markeggleston@gcc.gnu.org> 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.
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index d650407..9cc8136 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1077,6 +1077,11 @@ char_len_param_value (gfc_expr **expr, bool *deferred)
if (!gfc_expr_check_typed (*expr, gfc_current_ns, false))
return MATCH_ERROR;
+ /* If gfortran gets an EXPR_OP, try to simplifiy it. This catches things
+ like CHARACTER(([1])). */
+ if ((*expr)->expr_type == EXPR_OP)
+ gfc_simplify_expr (*expr, 1);
+
if ((*expr)->expr_type == EXPR_FUNCTION)
{
if ((*expr)->ts.type == BT_INTEGER