https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83079
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Harald Anlauf <anl...@gcc.gnu.org>: https://gcc.gnu.org/g:a8c234519366b9a93a4bbc0717d609de27ccdc0e commit r11-9487-ga8c234519366b9a93a4bbc0717d609de27ccdc0e Author: Harald Anlauf <anl...@gmx.de> Date: Tue Jan 11 22:06:10 2022 +0100 Fortran: fix ICE and wrong code with TRANSFER and CHARACTER(kind=4) gcc/fortran/ChangeLog: PR fortran/83079 * target-memory.c (gfc_interpret_character): Result length is in bytes and thus depends on the character kind. * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Compute correct string length for the result of the TRANSFER intrinsic and for temporaries for the different character kinds. gcc/testsuite/ChangeLog: PR fortran/83079 * gfortran.dg/transfer_char_kind4.f90: New test. (cherry picked from commit 29401b7b4581e9131e7057e263dcea8b40a6b5ab)