https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69891
--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > It's apparently a small loophole in the PR middle-end/31150 enhancement. In fact this is sufficient: Index: dse.c =================================================================== --- dse.c (revision 233545) +++ dse.c (working copy) @@ -2528,6 +2528,10 @@ scan_insn (bb_info_t bb_info, rtx_insn * i_ptr = i_ptr->next_local_store; } + /* But a call to memset clobbers memory so invalidates stores. It's + not only an optimization issue (the previous stores may be dead) + but also a correctness issue since the previous stores cannot be + seen as the source of the current value of the locations. */ if (memset_call) { rtx args[3]; @@ -2556,6 +2560,8 @@ scan_insn (bb_info_t bb_info, rtx_insn * active_local_stores = insn_info; } } + else + reset_active_stores (); } } else if (SIBLING_CALL_P (insn) && reload_completed)