https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99206
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- Potential fix that sets the string length (not regtested): diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 35f267db588..388aca7c38c 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -6887,6 +6887,8 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp, &source->where); if (source->ts.type == BT_DERIVED) result->ts.u.derived = source->ts.u.derived; + if (source->ts.type == BT_CHARACTER && result->ts.u.cl == NULL) + result->ts = source->ts; result->rank = rank; result->shape = gfc_get_shape (rank); for (i = 0; i < rank; i++)