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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |tree-optimization

--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2010-11-27 11:14:56 
UTC ---
It is vrp2 pass that miscompiles attached preprocessed file.

gcc-build/gcc/cc1 -O2 -fprofile-use

************* _.122t.reassoc2:

--cut here--
<bb 291>:
  # i_1950 = PHI <i_224(312), 0(290)>
  # lastkey_1951 = PHI <key_1983(312), 0(290)>
  vfr.11_1984 = vfr;
  D.25742_1985 = vfr.11_1984->PC;
  D.25743_1987 = vfr.11_1984->current_method;
  D.25744_1988 = D.25743_1987->code_length;
  if (D.25742_1985 >= D.25744_1988)
    goto <bb 292>;
  else
    goto <bb 293>;

...

<bb 312>:
  # prephitmp.1242_3787 = PHI <prephitmp.1236_3781(310), pretmp.1241_3786(311)>
  D.25872_2132 = prephitmp.1242_3787->current_state;
  merge_into (npc_2135, D.25872_2132);
  printf (&"i = %i\n"[0], i_1950);
  i_224 = i_1950 + 1;
  if (i_224 < npairs_1969)
    goto <bb 291>;
  else
    goto <bb 313>;

<bb 313>:

<bb 314>:
  vfr.56_882 = vfr;
  vfr.56_882->PC = -1;
  goto <bb 14> (<L386>);
--cut here--

************* _.123t.vrp:

--cut here--
<bb 295>:
  # lastkey_1951 = PHI <0(294), key_1983(315)>
  i_1950 = 0;
  vfr.11_1984 = vfr;
  D.25742_1985 = vfr.11_1984->PC;
  D.25743_1987 = vfr.11_1984->current_method;
  D.25744_1988 = D.25743_1987->code_length;
  if (D.25742_1985 >= D.25744_1988)
    goto <bb 296>;
  else
    goto <bb 297>;

...

<bb 315>:
  # prephitmp.1242_3787 = PHI <prephitmp.1236_3781(313), pretmp.1241_3786(314)>
  D.25872_2132 = prephitmp.1242_3787->current_state;
  merge_into (npc_2135, D.25872_2132);
  printf (&"i = %i\n"[0], 0);
  i_224 = 1;
  if (npairs_1969 > 1)
    goto <bb 295>;
  else
    goto <bb 316>;

<bb 316>:
--cut here--

See how i_1950 in _.123t.vrp dump  gets assigned to zero and consequently i_224
to one.

Reply via email to