https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110819
Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to AK from comment #2) > > When compiled with clang, libstdc++'s std::vector uses > > __builtin_operator_new which always has the -fassume-sane-operator-new > > semantics, and so can be optimized. > > yes clang optimizes with libstdc++ as well. what can be done in gcc for it > to detect that the new+delete pair can be optimized away? Basically we'll need __builtin_operator_new. See all the "see also" links.