https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77689
--- Comment #20 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #19) > for the original testcase in comment #0, renaming main to f and changing the > return type to void, the trunk of GCC can optimize the function to just a > return now. > > Note the renaming is because of inlining heurstics and the call to reserve > is not being inlined. > > So we can close this as fixed. I should say with -Ofast . Though `-O3 -fno-math-errno` is enough for that too.