aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2016-05-14 01:01:40 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2016-05-14 01:01:40 +0200
commit85ca20c9516879edf92356ee5d8a5c567db085a0 (patch)
tree310b3ae6402e5929bff678da27c70f03f786eb77 /gcc/combine.c
parentaa4b467b680f230ab11922d1e29695e1eaba12af (diff)
downloadgcc-85ca20c9516879edf92356ee5d8a5c567db085a0.zip
gcc-85ca20c9516879edf92356ee5d8a5c567db085a0.tar.gz
gcc-85ca20c9516879edf92356ee5d8a5c567db085a0.tar.bz2
combine: Don't call extract_left_shift with count < 0 (PR67483)
If the compiled program does a shift by a negative amount, combine will happily work with that, but it shouldn't then do an undefined operation in GCC itself. This patch fixes the first case mentioned in the bug report (I haven't been able to reproduce the second case, on trunk at least). PR rtl-optimization/67483 * combine.c (make_compound_operation): Don't call extract_left_shift with negative shift amounts. From-SVN: r236232
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 3554f51..cd864cc 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8037,6 +8037,7 @@ make_compound_operation (rtx x, enum rtx_code in_code)
&& ! (GET_CODE (lhs) == SUBREG
&& (OBJECT_P (SUBREG_REG (lhs))))
&& CONST_INT_P (rhs)
+ && INTVAL (rhs) >= 0
&& INTVAL (rhs) < HOST_BITS_PER_WIDE_INT
&& INTVAL (rhs) < mode_width
&& (new_rtx = extract_left_shift (lhs, INTVAL (rhs))) != 0)