aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-04-11 19:21:51 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-11 19:21:51 +0200
commitdf1c878ec25af7e9405b0276e6478fd996c2d3f9 (patch)
treed1d5ca050c0a8ac57a6d99ab8e91004a3a1aeec0 /gcc/simplify-rtx.c
parent8585103f053ef26a5939ec7c3a08ad77f70d2c3c (diff)
downloadgcc-df1c878ec25af7e9405b0276e6478fd996c2d3f9.zip
gcc-df1c878ec25af7e9405b0276e6478fd996c2d3f9.tar.gz
gcc-df1c878ec25af7e9405b0276e6478fd996c2d3f9.tar.bz2
re PR middle-end/80100 (simplify-rtx.c sanitizer detects undefined behaviour with optimization)
PR middle-end/80100 * simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Perform left shift in unsigned HOST_WIDE_INT type. * gcc.dg/pr80100.c: New test. From-SVN: r246851
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 4bbbe23..ce632ae 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2741,8 +2741,8 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
&& CONST_INT_P (XEXP (op0, 1))
&& INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT)
{
- int count = INTVAL (XEXP (op0, 1));
- HOST_WIDE_INT mask = INTVAL (trueop1) << count;
+ int count = INTVAL (XEXP (op0, 1));
+ HOST_WIDE_INT mask = UINTVAL (trueop1) << count;
if (mask >> count == INTVAL (trueop1)
&& trunc_int_for_mode (mask, mode) == mask