summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-30 11:52:15 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-30 11:52:15 +0000
commit15ff9e2f26a52378f7c3b21896bab011abcf882c (patch)
tree26810ef3d7ceee20229132ebc9fa4eda39210d05 /gcc/fold-const.c
parentcad0d474818927a2b7df258d34c28cf3a44a4331 (diff)
downloadgcc-15ff9e2f26a52378f7c3b21896bab011abcf882c.tar.gz
2013-08-30 Richard Biener <rguenther@suse.de>
* fold-const.c (fold_single_bit_test): Fix overflow test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202103 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1e0e7e5f985..f959f0a14a0 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6634,10 +6634,10 @@ fold_single_bit_test (location_t loc, enum tree_code code,
not overflow, adjust BITNUM and INNER. */
if (TREE_CODE (inner) == RSHIFT_EXPR
&& TREE_CODE (TREE_OPERAND (inner, 1)) == INTEGER_CST
- && TREE_INT_CST_HIGH (TREE_OPERAND (inner, 1)) == 0
+ && host_integerp (TREE_OPERAND (inner, 1), 1)
&& bitnum < TYPE_PRECISION (type)
- && 0 > compare_tree_int (TREE_OPERAND (inner, 1),
- bitnum - TYPE_PRECISION (type)))
+ && (TREE_INT_CST_LOW (TREE_OPERAND (inner, 1))
+ < (unsigned) (TYPE_PRECISION (type) - bitnum)))
{
bitnum += TREE_INT_CST_LOW (TREE_OPERAND (inner, 1));
inner = TREE_OPERAND (inner, 0);