https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92038
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #4) > Store-merging sees: > MEM[(struct &)&D.16119] ={v} {CLOBBER}; > MEM[(struct _Uninitialized *)&D.16119] ={v} {CLOBBER}; > MEM[(struct _Uninitialized *)&D.16119]._M_storage = 0; > MEM[(struct _Variant_storage *)&D.16119]._M_index = 0; > so perhaps we could just add handling of clobbers to store-merging, > similarly like we already handle = {} initializers; of course never remove > the clobbers, but just assume that zeros (or anything else) can be stored in > the bytes that actually weren't stored. Ah, yeah - that sounds like a nice trick. There may be cases where another value besides zero is cheaper (-1 comes to my mind here), not sure if we need to try optimize that.