https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108162
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Levo DeLellis from comment #3) > (In reply to Andrew Pinski from comment #2) > > Round 4 is because of this heuriheuristics. Name the function something > > besides main and try again. > > I couldn't reproduce. fn has more than xor eax/ret. godbolt shows the same. > x86-64 12.2 https://gcc.godbolt.org/z/WdacrE788 > > #include <vector> > int fn() { std::vector<int> v; v.push_back(1000); return 0; } > int main(int argc, char *argv[]) { fn(); } Right that is not inlining either. Anyways there are another bugs about not removing operator new/operator delete in some cases.