re PR tree-optimization/24142 (VRP miscompiles unzip inflate.c)

PR 24142
	* tree-vrp.c (vrp_meet): Fix call to range_includes_zero_p in
	case of anti-ranges.

testsuite/

	PR 24142
	* gcc.c-torture/execute/pr24142.c: New test.

From-SVN: r104874
This commit is contained in:
Diego Novillo 2005-10-02 20:15:55 +00:00 committed by Diego Novillo
parent f13c9b2c76
commit b19bb8b044
4 changed files with 37 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-10-02 Diego Novillo <dnovillo@redhat.com>
PR 24142
* tree-vrp.c (vrp_meet): Fix call to range_includes_zero_p in
case of anti-ranges.
2005-10-02 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18851

View File

@ -1,3 +1,8 @@
2005-10-02 Diego Novillo <dnovillo@redhat.com>
PR 24142
* gcc.c-torture/execute/pr24142.c: New test.
2005-10-01 Diego Novillo <dnovillo@redhat.com>
PR 24141

View File

@ -0,0 +1,19 @@
void abort (void);
int f (int a, int b)
{
if (a == 1)
a = 0;
if (b == 0)
a = 1;
if (a != 0)
return 0;
return 1;
}
int main (void)
{
if (f (1, 1) != 1)
abort ();
return 0;
}

View File

@ -3454,11 +3454,15 @@ vrp_meet (value_range_t *vr0, value_range_t *vr1)
no_meet:
/* The two range VR0 and VR1 do not meet. Before giving up and
setting the result to VARYING, see if we can at least derive a
useful anti-range. */
useful anti-range. FIXME, all this nonsense about distinguishing
anti-ranges from ranges is necessary because of the odd
semantics of range_includes_zero_p and friends. */
if (!symbolic_range_p (vr0)
&& !range_includes_zero_p (vr0)
&& ((vr0->type == VR_RANGE && !range_includes_zero_p (vr0))
|| (vr0->type == VR_ANTI_RANGE && range_includes_zero_p (vr0)))
&& !symbolic_range_p (vr1)
&& !range_includes_zero_p (vr1))
&& ((vr1->type == VR_RANGE && !range_includes_zero_p (vr1))
|| (vr1->type == VR_ANTI_RANGE && range_includes_zero_p (vr1))))
{
set_value_range_to_nonnull (vr0, TREE_TYPE (vr0->min));