summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-12 06:49:26 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-12 06:49:26 +0000
commit02846a3de5fde3992fcb95553bf624eeea1e6d40 (patch)
treeef4d7df0ac902cd3344cc6163ebed2ebb2fd927e /gcc/fold-const.c
parentc12ebabf2afbb96b8aa3b44ef980e5b2a2b14879 (diff)
downloadgcc-02846a3de5fde3992fcb95553bf624eeea1e6d40.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57050 138bc75d-0d04-0410-961f-82ee72b054a4
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 b8da1a74b26..1b2124a737e 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