https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69385
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> --- Hi, The immediate problem is that if (gfc_option.rtcheck & GFC_RTCHECK_MEM && gfc_expr_attr (expr1).allocatable && expr1->rank && !expr2->rank) { in gfc_trans_assignment_1 needs to be replaced with: if (gfc_option.rtcheck & GFC_RTCHECK_MEM && !init_flag && gfc_expr_attr (expr1).allocatable && expr1->rank && !expr2->rank) { This fixes this PR. However, looking again at this block, I think that the code is just not right. I will work on it. Cheers Paul