From 567357e12d0033ccc39ea5b896f075aa029bb3df Mon Sep 17 00:00:00 2001 From: Sintendo Date: Mon, 21 Dec 2020 11:05:22 +0100 Subject: [PATCH] JitArm64: srawix - Fix undefined behavior Signed bitwise left shift invokes UB when shifting a negative value. --- Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index 56e567a372..8a2062b239 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -631,10 +631,7 @@ void JitArm64::srawix(UGeckoInstruction inst) s32 imm = (s32)gpr.GetImm(s); gpr.SetImmediate(a, imm >> amount); - if (amount != 0 && (imm < 0) && (imm << (32 - amount))) - ComputeCarry(true); - else - ComputeCarry(false); + ComputeCarry(amount != 0 && (imm < 0) && (u32(imm) << (32 - amount))); if (inst.Rc) ComputeRC0(gpr.GetImm(a));