[Bug c++/104105] New: Unused nothrow new not optimized

denis.campredon at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 18 21:13:05 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104105

            Bug ID: 104105
           Summary: Unused nothrow new not optimized
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: denis.campredon at gmail dot com
  Target Milestone: ---

g++ can remove new calls when the result is unused, but fails to di the same
with nothrow new calls. f() could be compiled to an empty function with
optimisations on.

------------
void f() {
    new (std::nothrow) int(5);
    new (std::nothrow) int[5];
}
------------


More information about the Gcc-bugs mailing list