aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1996-10-24 12:08:23 -0700
committerJim Wilson <wilson@gcc.gnu.org>1996-10-24 12:08:23 -0700
commit5a9d82a6df29af137fb8677853eb9bd65ad147b3 (patch)
tree1236dbb51a904d3687dcefda7e20fd2693fa83e3 /gcc/fold-const.c
parent1908a152806f615fc287a75f6c19cf1be58dd9ca (diff)
downloadgcc-5a9d82a6df29af137fb8677853eb9bd65ad147b3.zip
gcc-5a9d82a6df29af137fb8677853eb9bd65ad147b3.tar.gz
gcc-5a9d82a6df29af137fb8677853eb9bd65ad147b3.tar.bz2
(make_range, case PLUS_EXPR): Normalize an unsigned
range that wraps around 0. From-SVN: r13030
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index cb45cd2..9b7fe45 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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;