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

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Upon closer inspection, evrp in GCC11 and mainline are generating slightly
different code which keeps FRE from cleaning this up in mainline.

Mainline is transforming the conditional here:

 <bb 8> :
  # c_3 = PHI <0(2), c_2(7)>
  # a_4 = PHI <a_9(D)(2), a_12(7)>
  if (a_4 <= 0)
    goto <bb 6>; [INV]
  else
    goto <bb 9>; [INV]

...into a_4 != 1.

This doesn't make a lot of sense until you realize that the testcase is
invoking undefined behavior.  Well, it still doesn't make sense, but "a" is
uninitialized in the test:

  for (long a; a < 1; ++a)

We should either initialize a to 0, or remove the test altogether.

Reply via email to