------- Additional Comments From steven at gcc dot gnu dot org 2005-07-14
19:42 -------
I believe this is the fix. Testing it now...
Index: tree-vrp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vrp.c,v
retrieving revision 2.40
diff -u -3 -p -r2.40 tree-vrp.c
--- tree-vrp.c 13 Jul 2005 22:35:29 -0000 2.40
+++ tree-vrp.c 14 Jul 2005 19:41:21 -0000
@@ -1175,15 +1175,23 @@ extract_range_from_binary_expr (value_ra
/* Compute the 4 cross operations. */
val[0] = vrp_int_const_binop (code, vr0.min, vr1.min);
+ /* If vr1.max == vr1.min, don't compute anything because we would
+ have vr0.min*vr1.min == vr0.min*vr1.max. */
val[1] = (vr1.max != vr1.min)
? vrp_int_const_binop (code, vr0.min, vr1.max)
: NULL_TREE;
+ /* Likewise for vr0.max == vr0.min. */
val[2] = (vr0.max != vr0.min)
? vrp_int_const_binop (code, vr0.max, vr1.min)
: NULL_TREE;
- val[3] = (vr0.min != vr1.min && vr0.max != vr1.max)
+ /* If vr0.min == vr0.max and vr1.min != vr1.max, then we already have
+ vr0.min*vr1.min in val[0] and vr0.min*vr1.max in val[1]. Likewise,
+ if vr0.min != vr0.max and vr1.min == vr1.max, then we have
+ vr0.min*vr1.min in val[0] and vr0.max*vr0.min in val[2]. Therefore
+ the fourth value is unique only if vr0 and vr1 are both ranges. */
+ val[3] = (vr0.min != vr0.max && vr1.min != vr1.max)
? vrp_int_const_binop (code, vr0.max, vr1.max)
: NULL_TREE;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22230