https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83168
--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- Thanks, Try this fix: diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index c9aad150..d26358c0 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1552,7 +1552,7 @@ select_string (st_parameter_dt *dtp, const fnode *f, char *buf, size_t *size, int kind) { char *result; - *size = size_from_kind (dtp, f, kind) + f->u.real.d; + *size = size_from_kind (dtp, f, kind) + f->u.real.d + 1; if (*size > BUF_STACK_SZ) result = xmalloc (*size); else