]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
combine.c (force_to_mode): Avoid undefined behaviour due to negative shift amount.
authorUlrich Weigand <ulrich.weigand@linaro.org>
Sat, 7 Jul 2012 12:19:50 +0000 (12:19 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Sat, 7 Jul 2012 12:19:50 +0000 (12:19 +0000)
* combine.c (force_to_mode) [LSHIFTRT]: Avoid undefined behaviour
due to negative shift amount.

From-SVN: r189347

gcc/ChangeLog
gcc/combine.c

index 70d0eb620f142470284daf764a6a3f92f23c2c14..1e1f7dca83bf7562b8414f908c7004c8e191c47d 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-07  Ulrich Weigand  <ulrich.weigand@linaro.org>
+
+       * combine.c (force_to_mode) [LSHIFTRT]: Avoid undefined behaviour
+       due to negative shift amount.
+
 2012-07-07  Hans-Peter Nilsson  <hp@axis.com>
 
        Fix configure test for "stack protector support in target C library".
index 70b80bca738e662d026968e600184a4ba1fcc2ec..ed87f1caa56e0e47baa982b3b00b4b4eb15f93b1 100644 (file)
@@ -8433,6 +8433,7 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask,
         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))
        {