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

diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index c4f7faaf597..307082b048d 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -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

Reply via email to