(make_range, case PLUS_EXPR): Normalize an unsigned
authorJim Wilson <wilson@gcc.gnu.org>
Thu, 24 Oct 1996 19:08:23 +0000 (12:08 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Thu, 24 Oct 1996 19:08:23 +0000 (12:08 -0700)
range that wraps around 0.

From-SVN: r13030

gcc/fold-const.c

index cb45cd28ee2519aa2eed712f2c0cf766ec1a9f3b..9b7fe455539fd77ecc41fec6321a93d3c80cfb0f 100644 (file)
@@ -2809,7 +2809,15 @@ make_range (exp, pin_p, plow, phigh)
              || (n_high != 0 && TREE_OVERFLOW (n_high)))
            break;
 
-         low = n_low, high = n_high;
+         /* Check for an unsigned range which has wrapped around the maximum
+            value thus making n_high < n_low, and normalize it.  */
+         if (n_low && n_high && tree_int_cst_lt (n_high, n_low))
+           {
+             low = n_high, high = n_low;
+             in_p = ! in_p;
+           }
+         else
+           low = n_low, high = n_high;
          exp = arg0;
          continue;