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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
int main (void)
{
  volatile int x = 1; 

  long t1 = 1/(2U-x);
  int t2 = 0!=(((int)(2%(2+t1)))/2);

  if (t1 != 1) __builtin_abort();
  if (t2 != 1) __builtin_abort();
  return 0;
}

---- CUT ----

  x.1_2 = (unsigned int) x.0_1;
  _3 = 2 - x.1_2;
  _4 = 1 / _3;
  _12 = _3 <= 1;
  _8 = (long int) _12;
  _6 = _8 << 1;
  if (_4 != 1)
...
  if (_6 != 2)

We know the range of _8 is [0, 1], so we should change _6 != 2 to _8 != 1
Which then gets simplified to _3 > 1.

As for the _4 != 1:
1/ (2-x) != 1 is always false?

Reply via email to