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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
There is a very old duplicate somewhere.  Happens with store-motion for a
simple

void foo (int n)
{
  int x, i;
  for (i = 0; i < n; ++i)
    x = i;
  bar (&x);
}

IIRC.  Of course requires us to re-write x into SSA form later, so some more
"clever" testcase is required.  LIM does:

  <bb 2>:
  if (n_4(D) > 0)
    goto <bb 3>;
  else
    goto <bb 9>;

  <bb 3>:
  x_lsm.3_5 = x;
^^^^
load of uninitialized x


  <bb 4>:
  # i_11 = PHI <i_6(5), 0(3)>
  x_lsm.3_1 = i_11;
  i_6 = i_11 + 1;
  if (n_4(D) > i_6)
    goto <bb 5>;
  else
    goto <bb 10>;

  <bb 10>:
  # x_lsm.3_9 = PHI <x_lsm.3_1(4)>
  x = x_lsm.3_9;
  goto <bb 7>;

now go find the duplicate ;)

Reply via email to