public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/94295] use __builtin_operator_new and __builtin_operator_delete when available
Date: Tue, 24 Mar 2020 21:34:54 +0000	[thread overview]
Message-ID: <bug-94295-4-Z4fcuFEnrc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94295-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Smith from comment #2)
> (In reply to Marc Glisse from comment #1)
> > (In reply to Richard Smith from comment #0)
> > > The C++ language rules do not permit optimization (eg, deletion) of direct
> > > calls to 'operator new' and 'operator delete'.
> > 
> > I thought that was considered a bug?
> 
> No, it's intentional: if the user directly calls '::operator new(42)' and
> they've replaced that function, the replacement function is guaranteed to be
> called. In this regard, 'operator new' is just a regular function with a
> funny name.
> 
> To be clear, the implicit call to 'operator new' produced by, say, 'new int'
> *is* optimizable, but a direct explicit call to 'operator new(sizeof(int))'
> is not.

Ah, since you are here, and you appeared as an author of N3664 but not N3537
(precisely when this subtlety happened), could you explain why? It isn't
discussed in the paper, complicates the design, and I cannot think of any use
for this distinction (there are workarounds if people don't want their explicit
call elided).

This of course doesn't at all prevent from adding a __builtin_operator_new
option in std::allocator, it only affects how motivated we should be to fix the
non-conformance.

  parent reply	other threads:[~2020-03-24 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 23:16 [Bug libstdc++/94295] New: " richard-gccbugzilla at metafoo dot co.uk
2020-03-24  7:04 ` [Bug libstdc++/94295] " glisse at gcc dot gnu.org
2020-03-24 20:26 ` richard-gccbugzilla at metafoo dot co.uk
2020-03-24 20:44 ` pinskia at gcc dot gnu.org
2020-03-24 21:04 ` richard-gccbugzilla at metafoo dot co.uk
2020-03-24 21:34 ` glisse at gcc dot gnu.org [this message]
2020-03-24 21:58 ` richard-gccbugzilla at metafoo dot co.uk
2020-03-26 20:08 ` glisse at gcc dot gnu.org
2021-07-19 16:06 ` redi at gcc dot gnu.org
2021-07-20 18:58 ` richard-gccbugzilla at metafoo dot co.uk
2021-07-20 19:00 ` redi at gcc dot gnu.org
2021-07-20 19:31 ` jason at gcc dot gnu.org
2021-07-20 19:44 ` redi at gcc dot gnu.org
2021-07-22 13:43 ` cvs-commit at gcc dot gnu.org
2021-07-22 13:44 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94295-4-Z4fcuFEnrc@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).