if (TYPE_SIGN (type) == SIGNED && wi::ge_p (op2.lower_bound (), 0, SIGNED))
{
unsigned prec = TYPE_PRECISION (type);
- // if a & b >=0 , then a >= 0.
- if (wi::ge_p (lhs.lower_bound (), 0, SIGNED))
+ // if a % b > 0 , then a >= 0.
+ if (wi::gt_p (lhs.lower_bound (), 0, SIGNED))
{
r = value_range (type, wi::zero (prec), wi::max_value (prec, SIGNED));
return true;
}
- // if a & b < 0 , then a <= 0.
+ // if a % b < 0 , then a <= 0.
if (wi::lt_p (lhs.upper_bound (), 0, SIGNED))
{
r = value_range (type, wi::min_value (prec, SIGNED), wi::zero (prec));
--- /dev/null
+/* PR tree-optimization/97888 */
+
+int a = 1, c = 4, d, e;
+
+int
+main ()
+{
+ int f = -173;
+ int b;
+ for (b = 0; b < 10; b++)
+ {
+ int g = f % (~0 && a), h = 0, i = 0;
+ if (g)
+ __builtin_unreachable ();
+ if (c)
+ h = f;
+ if (h > -173)
+ e = d / i;
+ f = h;
+ }
+ if (f != -173)
+ __builtin_abort ();
+ return 0;
+}