https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89516
--- Comment #2 from anlauf at gcc dot gnu.org --- The ICE is triggered by a code path that is executed only when -Wsurprising is used together with TRANSFER. I'm currently testing the following patch: Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (revision 269227) +++ gcc/fortran/check.c (working copy) @@ -5503,7 +5503,8 @@ if (result_elt_size == 0 && *source_size == 0 && !size) { *result_size = 0; - *result_length_p = 0; + if (result_length_p) + *result_length_p = 0; return true; } Will commit as obvious if it finishes successfully.