------- Comment #7 from rguenth at gcc dot gnu dot org  2007-02-19 15:56 -------
Constant propagation propagates through the PHI in this case:

<bb 2>:
  if (x_2(D) == 42) goto <L0>; else goto <L1>;

<L0>:;
  y_4 = 23;

  # y_1 = PHI <y_3(D)(2), 23(3)>
<L1>:;
  y_5 = 23;
  return 23;

so this would be the place where a warning could trigger.  But it's likely
this will introduce more false positives (so the "may" form is only done
very late).  The above could be warned as

"Warning: uninitialized value assumed to be 23."

it's like -Wstrict-overflow -- warn about valid optimizations of undefined
code (that is here, make it "dead").  In that sense it's a dup of the
mentioned PRs (it's treated as dead code).

So, let's make this a request for a warning for an optimization based on
the undefinedness of a value instead ;)


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30856

Reply via email to