public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aoliva at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/111904] Miscompilation with -O3 -fharden-control-flow-redundancy?
Date: Sat, 21 Oct 2023 04:47:47 +0000	[thread overview]
Message-ID: <bug-111904-4-KydfZjeSa8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111904-4@http.gcc.gnu.org/bugzilla/>

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
AFAICT the test expects stackbuf to remain unchanged across do_secret_stuff
calls, even though it's free stack space, but calling the hardcfr checker may
scribble over it.  But the real kicker is that, at -O3, do_secret_stuff gets
two different versions for each of the pass numbers, and in the specialization
for odd passes the stackbuf is optimized away entirely, and the visited bitmap
ends up assigned at stack space that overlaps with the stackbuf allocated
during the previous even pass, and that's what gets memcmp to fail at every
execution.  Adding attributes noclone and noipa to do_secret_stuff avoids the
specializations, and then the test passes even at -O3.

  parent reply	other threads:[~2023-10-21  4:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 22:25 [Bug c/111904] New: " sjames at gcc dot gnu.org
2023-10-20 22:28 ` [Bug c/111904] " sjames at gcc dot gnu.org
2023-10-21  4:47 ` aoliva at gcc dot gnu.org [this message]
2023-10-22 23:37 ` [Bug middle-end/111904] " sjames at gcc dot gnu.org
2023-10-23  0:09 ` bruno at clisp dot 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-111904-4-KydfZjeSa8@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).