public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/112616] [11/12/13/14 Regression] wrong code at -O{s,2,3} on x86_64-linux-gnu
Date: Mon, 20 Nov 2023 09:55:30 +0000	[thread overview]
Message-ID: <bug-112616-4-GwoDls3dNX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112616-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org
            Version|unknown                     |13.2.1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
IPA-SRA at work.  With -fno-inline added you see

-long int p ()
+void p.isra ()
 {
...
@@ -106,13 +82,13 @@
   i.2_2 = i;
   h.3_3 = h;
   *i.2_2 = h.3_3;
-  _4 = o ();
+  o.isra ();

   <bb 4> [local count: 1073741824]:
-  # q_11 = PHI <0B(2), _4(3)>
-  _5 = *q_11;
-  _10 = (long int) _5;
-  return _10;
+  # q_5 = PHI <0B(2), removed_return.17_12(D)(3)>
+  _6 = *q_5;
+  _7 = (long int) _6;
+  return;


Note the issue is that we end up with the following after inlining:

  <bb 5> [local count: 1073741824]:
  # q_11 = PHI <0B(2), removed_return.14_14(D)(4), removed_return.14_14(D)(3)>
  _12 = *q_11;

and CCP will optimistically simplify q_11 to 0B because accessing the
removed_return.14_14(D) would be undefined behavior.

That means substituting a default-def isn't correct - it exposes undefined
behavior on valid paths of the program.

  parent reply	other threads:[~2023-11-20  9:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-19  5:24 [Bug tree-optimization/112616] New: " zhendong.su at inf dot ethz.ch
2023-11-19 19:20 ` [Bug tree-optimization/112616] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-11-19 19:24 ` [Bug ipa/112616] " pinskia at gcc dot gnu.org
2023-11-19 19:25 ` pinskia at gcc dot gnu.org
2023-11-20  9:55 ` rguenth at gcc dot gnu.org [this message]
2023-12-07  9:49 ` [Bug ipa/112616] [11/12/13/14 Regression] wrong code at -O{s,2,3} on x86_64-linux-gnu since r10-3311 jakub at gcc dot gnu.org
2024-01-05 15:37 ` jamborm at gcc dot gnu.org
2024-01-16 12:48 ` jamborm at gcc dot gnu.org
2024-01-24 18:14 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:09 ` jamborm at gcc dot gnu.org
2024-04-08 15:51 ` [Bug ipa/112616] [11/12/13 " cvs-commit at gcc dot gnu.org
2024-05-15 13:46 ` [Bug ipa/112616] [11/12 " cvs-commit 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-112616-4-GwoDls3dNX@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).