https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117751
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> --- Hmm, the docs for the new option say: "With -fno-assume-sane-operators-new-delete option GCC must assume all these calls (whether from new or delete expressions or called directly) may read and write global state unless proven otherwise (e.g. when GCC compiles their implementation)." So for most of the tests I listed in comment 10, GCC compiles the implementation and knows that operator new touches global memory. I'm not sure why -fwhole-program changes that for 18_support/50594.cc but it does.