From 706fd3a42e80178029a9373679d203652f36147b Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 20 Jun 2014 06:30:19 +0000 Subject: [PATCH] * tree-ssa-math-opts.c (do_shift_rotate, find_bswap_or_nop_1): Cast 0xff to uint64_t before shifting it up. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211837 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-math-opts.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03ce0d2b3cc..357596f8251 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-06-20 Jakub Jelinek + + * tree-ssa-math-opts.c (do_shift_rotate, find_bswap_or_nop_1): Cast + 0xff to uint64_t before shifting it up. + 2014-06-20 Julian Brown Chung-Lin Tang diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 21345473e77..ca2b30dbc52 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -1669,7 +1669,8 @@ do_shift_rotate (enum tree_code code, break; case RSHIFT_EXPR: /* Arithmetic shift of signed type: result is dependent on the value. */ - if (!TYPE_UNSIGNED (n->type) && (n->n & (0xff << (bitsize - 8)))) + if (!TYPE_UNSIGNED (n->type) + && (n->n & ((uint64_t) 0xff << (bitsize - 8)))) return false; n->n >>= count; break; @@ -1903,7 +1904,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit) old_type_size = TYPE_PRECISION (n->type); if (!TYPE_UNSIGNED (n->type) && type_size > old_type_size - && n->n & (0xff << (old_type_size - 8))) + && n->n & ((uint64_t) 0xff << (old_type_size - 8))) return NULL; if (type_size / BITS_PER_UNIT < (int)(sizeof (int64_t))) -- 2.11.4.GIT