From: Denis Rastyogin <ger...@altlinux.org>

Change shift operand from 32-bit literal `1` to 64-bit `1ULL` to avoid 
undefined behavior
when shifting bits beyond the width of a 32-bit integer.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Rastyogin <ger...@altlinux.org>
---
 target/ppc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 27f90c3cc5..8e69c4cb48 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -2998,7 +2998,7 @@ static void gen_fetch_inc_conditional(DisasContext *ctx, 
MemOp memop,
 
     /* RT = (t != t2 ? t : u = 1<<(s*8-1)) */
     tcg_gen_movcond_tl(cond, cpu_gpr[rD(ctx->opcode)], t, t2, t,
-                       tcg_constant_tl(1 << (memop_size(memop) * 8 - 1)));
+                       tcg_constant_tl(1ULL << (memop_size(memop) * 8 - 1)));
 }
 
 static void gen_ld_atomic(DisasContext *ctx, MemOp memop)
-- 
2.42.2


Reply via email to