aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-10-24 09:10:37 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-10-24 09:10:37 -0400
commit7f423031c0b5c54dd088dd25fb8d64ca3c3bb94a (patch)
treefa1e8f986c3c3855e54d39d20286a018c1bde3fd /gcc
parent70e7fabe9e7e2db26a3a25424ada897e4365583f (diff)
downloadgcc-7f423031c0b5c54dd088dd25fb8d64ca3c3bb94a.zip
gcc-7f423031c0b5c54dd088dd25fb8d64ca3c3bb94a.tar.gz
gcc-7f423031c0b5c54dd088dd25fb8d64ca3c3bb94a.tar.bz2
(make_range, comparison cases): When making range for unsigned to
merge in, use full range. From-SVN: r13027
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 2af2f8b..cb45cd2 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2757,15 +2757,20 @@ make_range (exp, pin_p, plow, phigh)
exp = arg0;
- /* If this is an unsigned comparison, we also know that EXP
- is greater than or equal to zero. We base the range tests
- we make on that fact, so we record it here so we can parse
- existing range tests. */
- if (TREE_UNSIGNED (type))
+ /* If this is an unsigned comparison, we also know that EXP is
+ greater than or equal to zero and less than the maximum value of
+ the unsigned type. We base the range tests we make on that fact,
+ so we record it here so we can parse existing range tests. */
+ if (TREE_UNSIGNED (type) && (low == 0 || high == 0))
{
if (! merge_ranges (&n_in_p, &n_low, &n_high, in_p, low, high,
1, convert (type, integer_zero_node),
- NULL_TREE))
+ const_binop (MINUS_EXPR,
+ convert (type,
+ integer_zero_node),
+ convert (type,
+ integer_one_node),
+ 0)))
break;
in_p = n_in_p, low = n_low, high = n_high;