aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorHartmut Penner <hpenner@de.ibm.com>2002-09-12 06:49:26 +0000
committerRichard Henderson <rth@gcc.gnu.org>2002-09-11 23:49:26 -0700
commit4f968d9388efc8dfec39cf0ec0dbb38378fdb6f8 (patch)
treeef4d7df0ac902cd3344cc6163ebed2ebb2fd927e /gcc/fold-const.c
parentd0c97db6b3b562dfdd2be66bd36d4626e05b68da (diff)
downloadgcc-4f968d9388efc8dfec39cf0ec0dbb38378fdb6f8.zip
gcc-4f968d9388efc8dfec39cf0ec0dbb38378fdb6f8.tar.gz
gcc-4f968d9388efc8dfec39cf0ec0dbb38378fdb6f8.tar.bz2
fold-const.c (make_range): Only narrow to signed range if the signed range is smaller than the unsigned range.
* fold-const.c (make_range): Only narrow to signed range if the signed range is smaller than the unsigned range. * gcc.c-torture/execute/20020911-1.c: New. From-SVN: r57050
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b8da1a7..1b2124a 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3089,9 +3089,10 @@ make_range (exp, pin_p, plow, phigh)
= TYPE_MAX_VALUE (equiv_type) ? TYPE_MAX_VALUE (equiv_type)
: TYPE_MAX_VALUE (type);
- high_positive = fold (build (RSHIFT_EXPR, type,
- convert (type, high_positive),
- convert (type, integer_one_node)));
+ if (TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (exp)))
+ high_positive = fold (build (RSHIFT_EXPR, type,
+ convert (type, high_positive),
+ convert (type, integer_one_node)));
/* If the low bound is specified, "and" the range with the
range for which the original unsigned value will be