From: Paul Floyd Date: Thu, 28 Mar 2024 08:06:23 +0000 (+0100) Subject: coverity: dead code and overflows X-Git-Tag: VALGRIND_3_23_0~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba728d01c09438a044a57888e89654789a12d8c9;p=thirdparty%2Fvalgrind.git coverity: dead code and overflows Overflows deliberate. Dead code probably not. --- diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index adb5c7287..da1cabc3c 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -3662,7 +3662,6 @@ ULong amd64g_calculate_RCR ( ULong arg, } break; case 4: - while (tempCOUNT >= 33) tempCOUNT -= 33; cf = (rflags_in >> AMD64G_CC_SHIFT_C) & 1; of = ((arg >> 31) ^ cf) & 1; while (tempCOUNT > 0) { @@ -3730,7 +3729,6 @@ ULong amd64g_calculate_RCL ( ULong arg, of = ((arg >> 63) ^ cf) & 1; break; case 4: - while (tempCOUNT >= 33) tempCOUNT -= 33; cf = (rflags_in >> AMD64G_CC_SHIFT_C) & 1; while (tempCOUNT > 0) { tempcf = (arg >> 31) & 1; diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c index 8a8743866..3b33c48c3 100644 --- a/VEX/priv/guest_arm64_toIR.c +++ b/VEX/priv/guest_arm64_toIR.c @@ -8047,8 +8047,13 @@ static Bool AdvSIMDExpandImm ( /*OUT*/ULong* res, case 1: testimm8 = True; imm64 = Replicate32x2(imm8 << 8UL); break; case 2: + // Coverity is right but we want the overflow, Replicate32x2 expects + // (and asserts) that the top 32bits be zero so if we get rid of the + // overflow we would need to add a mask. So just let it overflow. + // coverity[OVERFLOW_BEFORE_WIDEN:FALSE] testimm8 = True; imm64 = Replicate32x2(imm8 << 16UL); break; case 3: + // coverity[OVERFLOW_BEFORE_WIDEN:FALSE] testimm8 = True; imm64 = Replicate32x2(imm8 << 24UL); break; case 4: testimm8 = False; imm64 = Replicate16x4(imm8); break;