aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-08-30 11:52:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-08-30 11:52:15 +0000
commit26d75703036bbdd170c157fd70a5ff1a29c27f22 (patch)
tree26810ef3d7ceee20229132ebc9fa4eda39210d05 /gcc/fold-const.c
parentf7e088e7de99b6ab31dc56d2a3ed358647207256 (diff)
downloadgcc-26d75703036bbdd170c157fd70a5ff1a29c27f22.zip
gcc-26d75703036bbdd170c157fd70a5ff1a29c27f22.tar.gz
gcc-26d75703036bbdd170c157fd70a5ff1a29c27f22.tar.bz2
fold-const.c (fold_single_bit_test): Fix overflow test.
2013-08-30 Richard Biener <rguenther@suse.de> * fold-const.c (fold_single_bit_test): Fix overflow test. From-SVN: r202103
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 1e0e7e5..f959f0a 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);