[clang] [Sema] Fixed faulty shift count warning (PR #69521)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 04:17:44 PDT 2023


================
@@ -12120,8 +12120,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS,
     auto FXSema = S.Context.getFixedPointSemantics(LHSExprType);
     LeftSize = FXSema.getWidth() - (unsigned)FXSema.hasUnsignedPadding();
   }
-  llvm::APInt LeftBits(Right.getBitWidth(), LeftSize);
-  if (Right.uge(LeftBits)) {
+  if (Right.uge(LeftSize)) {
----------------
bjope wrote:

Oops, sorry. Now I think my previous comment was wrong. I missed the `getActiveBits()` check in APInt::ult. So it should be fine without complicating it that way.

https://github.com/llvm/llvm-project/pull/69521


More information about the cfe-commits mailing list