public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104105] New: Unused nothrow new not optimized
@ 2022-01-18 21:13 denis.campredon at gmail dot com
  2022-01-18 23:36 ` [Bug c++/104105] " pinskia at gcc dot gnu.org
  2022-01-19 10:28 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: denis.campredon at gmail dot com @ 2022-01-18 21:13 UTC (permalink / raw)
  To: gcc-bugs

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];
}
------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/104105] Unused nothrow new not optimized
  2022-01-18 21:13 [Bug c++/104105] New: Unused nothrow new not optimized denis.campredon at gmail dot com
@ 2022-01-18 23:36 ` pinskia at gcc dot gnu.org
  2022-01-19 10:28 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-18 23:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/104105] Unused nothrow new not optimized
  2022-01-18 21:13 [Bug c++/104105] New: Unused nothrow new not optimized denis.campredon at gmail dot com
  2022-01-18 23:36 ` [Bug c++/104105] " pinskia at gcc dot gnu.org
@ 2022-01-19 10:28 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-19 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-01-19
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We're keying on DECL_IS_REPLACEABLE_OPERATOR_NEW_P which it seems
the
std::nothrow variant is not.  There's also valid_new_delete_pair_p for
eliding pairs of new/delete if otherwise unused, the nothrow variants do
seem to be handled there.

The std::nothrow variant is DECL_IS_OPERATOR_NEW_P but it's not marked
replaceable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-19 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 21:13 [Bug c++/104105] New: Unused nothrow new not optimized denis.campredon at gmail dot com
2022-01-18 23:36 ` [Bug c++/104105] " pinskia at gcc dot gnu.org
2022-01-19 10:28 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).