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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't think this has anything to do with reassoc though.
The testcase looks incorrect to me.
Because d is defined in the scope of the outer loop's body, for b == 0 a is -1U
and
so the inner loop does nothing, d is set to 1, a is set to 0 and then d goes
out of scope.
Then for b = 1, a scope with d variable is entered but the variable is again
uninitialized, a <= 0 is true, and we use the uninitialized variable.
fixup_cfg1 dump shows this nicely with the clobber in there:

  <bb 2> :
  b = 0;
  goto <bb 6>; [INV]

  <bb 3> :
  d.0_1 = d;
  if (d.0_1 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 4> :
L:
  a.1_2 = a;
  if (a.1_2 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  d = 1;
  a.2_3 = a;
  _4 = a.2_3 + 1;
  a = _4;
  d = {CLOBBER(eol)};
  b = b + 1;

  <bb 6> :
  if (b <= 1)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  D.2753 = 0;
  return D.2753;

Reply via email to