https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84003
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- Looks like we eventually need sth like /* If the later store we delete could have changed the dynamic type of the memory make sure the one we preserve serves as a store for all loads that could validly have accessed the one we delete. */ store_info *r_info = s_info->redundant_reason->store_rec; while (r_info) { if (r_info->is_set && (MEM_ALIAS_SET (s_info->mem) != MEM_ALIAS_SET (r_info->mem))) set_mem_alias_set (r_info->mem, 0); r_info = r_info->next; } to catch them all? Also there's another "copy" of the code in dse_step6. Adjusting the patch accordingly.