https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104007
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:7ca21601704c4a637f3cefa7c8814920782354d8 commit r12-6694-g7ca21601704c4a637f3cefa7c8814920782354d8 Author: Jason Merrill <ja...@redhat.com> Date: Mon Jan 17 17:08:03 2022 -0500 c++: new (nothrow) array cleanup [PR104007] For this testcase, the cleanup that is supposed to happen if initialization throws was wrongly being run on the normal control path as well. This turns out to be because the EH-only handling in gimple_push_cleanup didn't apply to conditional cleanups such as we have for nothrow new, since we check whether the result is non-null before proceeding with the initialization. PR c++/104007 gcc/ChangeLog: * gimplify.cc (gimple_push_cleanup): Handle eh_only in conditional context. gcc/testsuite/ChangeLog: * g++.dg/eh/new2.C: New test.