https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77517
--- Comment #6 from Harald Anlauf <anlauf at gmx dot de> --- Extending the check in comment #5 to if (from->ts.type == BT_CLASS && to->ts.type != BT_CLASS || to->ts.type == BT_CLASS && from->ts.type != BT_CLASS) { gfc_error ("The FROM and TO arguments at %L are incompatible", &to->where); return false; } also avoids the ICE for program p class(*), allocatable :: a, b call move_alloc (a, b) contains subroutine b end end