https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102958
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #11) > Before r15-6990-g44d21551362f90 the code for g() was very branchy and > included branches that allocate memory, and so can throw bad_alloc. After > that commit, the allocations and exceptional path are gone in g(), but we > still have two calls to deallocate with _ZdlPvm (which are unreachable > because we don't have anything to deallocate!) Oh actually, the codegen is identical at -O2 since r15-6990-g44d21551362f90, so it's only at -O1 there's a difference between f() and g(). I don't know if we care about that, or if this can be considered fixed by richi's patch.