re PR tree-optimization/23129 (VRP propagates division of antiranges incorrectly)

2005-08-02  James A. Morrison  <phython@gcc.gnu.org>

        PR tree-optimization/23129
        * tree-vrp.c (extract_range_from_binary_expr): Set value range to
        varying for divisions with anti-ranges.

From-SVN: r102653
This commit is contained in:
James A. Morrison 2005-08-02 05:08:40 +00:00
parent bf2f958806
commit 08303d5bb4
4 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-08-02 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/23129
* tree-vrp.c (extract_range_from_binary_expr): Set value range to
varying for divisions with anti-ranges.
2005-08-02 Jan Hubicka <jh@suse.cz>
* tree-ssa-dom.c (thread_across_edge): Remove updating here.

View File

@ -1,3 +1,7 @@
2005-08-02 James A. Morrison <phython@gcc.gnu.org>
* gcc.c-torture/execute/vrp-4.c: New test.
2005-08-02 Jan Hubicka <jh@suse.cz>
* update-threading.c: New test.

View File

@ -0,0 +1,20 @@
extern void exit (int);
extern void abort ();
void test(int x, int y)
{
int c;
if (x == 1) abort();
if (y == 1) abort();
c = x / y;
if (c != 1) abort();
}
int main()
{
test(2, 2);
exit (0);
}

View File

@ -1136,7 +1136,8 @@ extract_range_from_binary_expr (value_range_t *vr, tree expr)
the new range. */
/* Divisions by zero result in a VARYING value. */
if (code != MULT_EXPR && range_includes_zero_p (&vr1))
if (code != MULT_EXPR
&& (vr0.type == VR_ANTI_RANGE || range_includes_zero_p (&vr1)))
{
set_value_range_to_varying (vr);
return;