https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94293
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- Adding inline void* operator new(std::size_t n){return __builtin_malloc(n);} inline void operator delete(void*p)noexcept{__builtin_free(p);} inline void operator delete(void*p,std::size_t)noexcept{__builtin_free(p);} lets gcc optimize. Without it, we end up with _37 = operator new (51); __builtin_memcpy (_37, "Hey... no small-string optimization for me please!", 50); MEM[(char_type &)_37 + 50] = 0; operator delete (_37, 51); return 123; I expect DSE (via tree-ssa-alias.c) doesn't know about delete the way it knows about free and thus doesn't see the stores as dead.