From 67586d38f5b1858fba96973e9341f7d65f64ea9c Mon Sep 17 00:00:00 2001 From: Markus Trippelsdorf Date: Thu, 1 Dec 2016 14:04:13 +0000 Subject: [PATCH] Fix rtl-optimization/78596 - combine.c:12561:14: runtime error: left shift of negative value PR rtl-optimization/78596 * combine.c (simplify_comparison): Cast to unsigned to avoid left shifting of negative value. From-SVN: r243111 --- gcc/ChangeLog | 6 ++++++ gcc/combine.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d15a7308db..b90cbc6ffa2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-12-01 Markus Trippelsdorf + + PR rtl-optimization/78596 + * combine.c (simplify_comparison): Cast to unsigned to avoid + left shifting of negative value. + 2016-12-01 Matthias Klose * doc/install.texi: Don't use pkg-config to check for bdw-gc. diff --git a/gcc/combine.c b/gcc/combine.c index faafcb741f4..b4294532296 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -12561,7 +12561,8 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) if (GET_CODE (op0) == LSHIFTRT) code = unsigned_condition (code); - const_op <<= INTVAL (XEXP (op0, 1)); + const_op = (unsigned HOST_WIDE_INT) const_op + << INTVAL (XEXP (op0, 1)); if (low_bits != 0 && (code == GT || code == GTU || code == LE || code == LEU)) -- 2.30.2