OSDN Git Service

(make_range, case PLUS_EXPR): Normalize an unsigned
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Oct 1996 19:08:23 +0000 (19:08 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Oct 1996 19:08:23 +0000 (19:08 +0000)
range that wraps around 0.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13030 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fold-const.c

index cb45cd2..9b7fe45 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;