summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-07 12:19:50 +0000
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-07 12:19:50 +0000
commit7c4d4cbb54a12d1c3b733c3d0f32adbf4be092fc (patch)
treea76cf9cd464e775a8a81e55e7aefb1eb28db63a7
parente8adf5570d287b9e07608f93d085dc720b32c737 (diff)
downloadgcc-7c4d4cbb54a12d1c3b733c3d0f32adbf4be092fc.tar.gz
* combine.c (force_to_mode) [LSHIFTRT]: Avoid undefined behaviour
due to negative shift amount. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189347 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/combine.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 70d0eb620f1..1e1f7dca83b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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".
diff --git a/gcc/combine.c b/gcc/combine.c
index 70b80bca738..ed87f1caa56 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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))
{