https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64757
--- Comment #6 from janus at gcc dot gnu.org --- The following is sufficient to get rid of the ICE: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (Revision 220084) +++ gcc/fortran/trans-expr.c (Arbeitskopie) @@ -6490,6 +6490,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_comp routine below is motivated by the alloc_scalar_allocatable_for_ assignment() routine, but with the realloc portions removed and different input. */ + if (cm->ts.type == BT_CLASS) + dest = gfc_class_data_get (dest); alloc_scalar_allocatable_for_subcomponent_assignment (&block, dest, cm, However, one needs to do more to get the correct run-time behavior: The _vptr needs to be set for the class component and one needs to use the correct size for the memory allocation.