------- Comment #11 from rguenth at gcc dot gnu dot org  2007-04-11 22:17 
-------
Actually 22456 is CCP ignoring uninitialized vars on phi merging.  Testcase:

int foo(int f)
{
  int i;
  if (f)
    i = 5;
  return i;
}

CCP makes it return 5, so the set of i and the PHI becomes dead.  Before CCP
we have:

<bb 2>:
  if (f_2(D) != 0) goto <L0>; else goto <L1>;

<L0>:;
  i_4 = 5;

  # i_1 = PHI <i_3(D)(2), i_4(3)>
<L1>:;
  i_5 = i_1;

while CCP transforms it to

<bb 2>:
  if (f_2(D) != 0) goto <L0>; else goto <L1>;

<L0>:;
  i_4 = 5;

  # i_1 = PHI <i_3(D)(2), 5(3)>
<L1>:;
  i_5 = 5;

and the next DCE pass removes all but a return 5;

This can be fixed by making CCP not use undefined behavior.


-- 


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

Reply via email to