Fortran: fix ICE in get_expr_storage_size [PR108421]
Commit Message
Dear all,
here's an obvious patch for an ICE-on-invalid where we missed
a check that we actually have an integer length before trying
to extract a usable value.
Regtested on x86_64-pc-linux-gnu.
I intend to commit it to mainline within the next 24h unless
there are comments.
Cheers,
Harald
@@ -2858,6 +2858,7 @@ get_expr_storage_size (gfc_expr *e)
if (e->ts.type == BT_CHARACTER)
{
if (e->ts.u.cl && e->ts.u.cl->length
+ && e->ts.u.cl->length->ts.type == BT_INTEGER
&& e->ts.u.cl->length->expr_type == EXPR_CONSTANT)
strlen = mpz_get_si (e->ts.u.cl->length->value.integer);
else if (e->expr_type == EXPR_CONSTANT