[Bug tree-optimization/67121] [6 Regression] wrong code at -O3 on x86_64-linux-gnu

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 5 10:43:00 GMT 2015


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm.

Visiting statement:
h_38 = (char) pretmp_48;
Found new range for h_38: VARYING

...

Visiting statement:
_42 = (int) h_38;
Intersecting
  [-128, 127]
and
  [0, 127]
to
  [0, 127]
Found new range for _42: [0, 127]

so it seems that the old value-range for _42 is bad:

  # RANGE [0, 127] NONZERO 127
  _42 = (int) h_38;

Before if-conversion we have

  <bb 2>:
  a[0] = 1;
  f = 0;
  pretmp_48 = c;

  <bb 3>:
  # f.4_36 = PHI <0(2), _19(6)>
  # ivtmp_59 = PHI <9(2), ivtmp_28(6)>
  h_9 = (char) pretmp_48;
  if (h_9 >= 0)
    goto <bb 4>;
  else
    goto <bb 10>;

  <bb 4>:
  # RANGE [0, 127] NONZERO 127
  _10 = (int) h_9;

while after:

  <bb 2>:
  a[0] = 1;
  f = 0;
  pretmp_48 = c;

  <bb 3>:
  # f.4_36 = PHI <0(2), _19(4)>
  # ivtmp_59 = PHI <9(2), ivtmp_28(4)>
  h_9 = (char) pretmp_48;
  # RANGE [0, 127] NONZERO 127
  _10 = (int) h_9;
...
  prephitmp_3 = h_9 >= 0 ? _14 : _38;

so if-conversion has to reset value-range info on stmts previously
conditionally
executed.



More information about the Gcc-bugs mailing list