diff options
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8146920..808f491 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -11611,7 +11611,13 @@ fold_binary_loc (location_t loc, if (integer_pow2p (sval) && tree_int_cst_sgn (sval) > 0) { tree sh_cnt = TREE_OPERAND (arg1, 1); - unsigned long pow2 = exact_log2 (TREE_INT_CST_LOW (sval)); + unsigned long pow2; + + if (TREE_INT_CST_LOW (sval)) + pow2 = exact_log2 (TREE_INT_CST_LOW (sval)); + else + pow2 = exact_log2 (TREE_INT_CST_HIGH (sval)) + + HOST_BITS_PER_WIDE_INT; if (strict_overflow_p) fold_overflow_warning (("assuming signed overflow does not " |