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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And I think the commit doesn't implement what Bruno wrote.
In particular, it was
b >= 0 && a % b > 0 implies a >= 0
b >= 0 && a % b < 0 implies a <= 0
while the patch implemented
b >= 0 && a % b >= 0 implies a >= 0
b >= 0 && a % b < 0 implies a <= 0

Consider -4 % 4, b >= 0 and a % b == 0, which is >= 0, but a is < 0.

So, another miscompiled testcase is:
__attribute__((noipa)) void
foo (int i)
{
  if ((i % 7) >= 0)
    {
      if (i >= 0)
        __builtin_abort ();
    }
}

int
main ()
{
  foo (-7);
  foo (-21);
  return 0;
}

Reply via email to