public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thiago at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/109896] Missed optimisation: overflow detection in multiplication instructions for operator new
Date: Thu, 18 May 2023 00:13:07 +0000	[thread overview]
Message-ID: <bug-109896-4-K51TmmAxhT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109896-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Andrew Pinski from comment #4)
> If you are that picky for cycles, these cycles are not going to be a problem
> compared to the dynamic allocation that is just about to happen ......

Yeah, I realised that after I posted the reply. If the calculation is
successful, we're going to allocate memory and that's neither fast nor
determinstic. If it overflows, we're going to unwind the stack, which is even
worse. I had only looked at the multiplication and failed to consider what
comes after it.

So, yeah, do this if it's a low-hanging fruit.

  parent reply	other threads:[~2023-05-18  0:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 18:34 [Bug target/109896] New: " thiago at kde dot org
2023-05-17 18:45 ` [Bug target/109896] " pinskia at gcc dot gnu.org
2023-05-17 20:39 ` hjl.tools at gmail dot com
2023-05-17 23:42 ` thiago at kde dot org
2023-05-17 23:46 ` pinskia at gcc dot gnu.org
2023-05-18  0:13 ` thiago at kde dot org [this message]
2023-05-18  8:33 ` redi at gcc dot gnu.org
2023-05-18 14:08 ` thiago at kde dot org
2024-06-06 16:49 ` [Bug c++/109896] " pinskia at gcc dot gnu.org
2024-06-06 22:03 ` pinskia at gcc dot gnu.org
2024-06-07  1:42 ` pinskia at gcc dot gnu.org
2024-06-07 14:05 ` pinskia 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-109896-4-K51TmmAxhT@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).