vrp: Fix operator_trunc_mod::op1_range [PR97888]
authorJakub Jelinek <jakub@redhat.com>
Wed, 18 Nov 2020 21:13:06 +0000 (22:13 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 18 Nov 2020 21:13:06 +0000 (22:13 +0100)
commit71c9d2b088c9d409a1bd3b50523ac4623a5bf1b4
treedbc66d21164a5d8b90a15b1bd222d78b50d0cd2c
parent84e0549ce206357dcd384cf8db14322c686d1eb2
vrp: Fix operator_trunc_mod::op1_range [PR97888]

As mentioned in the PR, in (x % y) >= 0 && y >= 0, we can't deduce
x's range to be x >= 0, as e.g. -7 % 7 is 0.  But we can deduce it
from (x % y) > 0.  The patch also fixes up the comments.

2020-11-18  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/91029
PR tree-optimization/97888
* range-op.cc (operator_trunc_mod::op1_range): Only set op1
range to >= 0 if lhs is > 0, rather than >= 0.  Fix up comments.

* gcc.dg/pr91029.c: Add comment with PR number.
(f2): Use > 0 rather than >= 0.
* gcc.c-torture/execute/pr97888-1.c: New test.
* gcc.c-torture/execute/pr97888-2.c: New test.
gcc/range-op.cc
gcc/testsuite/gcc.c-torture/execute/pr97888-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr97888-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr91029.c