Message ID | 201207061311.q66DBHwE028422@d06av02.portsmouth.uk.ibm.com |
---|---|
State | New |
Headers | show |
> Note that most other places in force_to_mode optimizing shifts already > check for non-negative shift amounts; but in this place the check is > missing. > > The following patch adds the check here as well, fixing the undefined > behaviour (and subsequent bootstrap comparison failure) in my test. > > Tested on arm-linux-gnueabihf. OK for mainline? Sure, but given that there is indeed the same pattern a few lines above, you could as well have installed it as obvious. OK for 4.7 too if you need it.
=== modified file 'gcc/combine.c' --- gcc/combine.c 2012-02-22 12:22:43 +0000 +++ gcc/combine.c 2012-07-03 19:46:18 +0000 @@ -8432,6 +8432,7 @@ in OP_MODE. */ if (CONST_INT_P (XEXP (x, 1)) + && INTVAL (XEXP (x, 1)) >= 0 && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT && HWI_COMPUTABLE_MODE_P (op_mode)) {