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.

Reply via email to