[clang] [analyzer] Do not use APInt methods on _BitInt() Types (PR #65887)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 17 13:48:26 PDT 2023


================
@@ -598,6 +598,12 @@ SVal SValBuilder::evalIntegralCast(ProgramStateRef state, SVal val,
   APSIntType ToType(getContext().getTypeSize(castTy),
                     castTy->isUnsignedIntegerType());
   llvm::APSInt ToTypeMax = ToType.getMaxValue();
+  // With the introduction of _BitInt(), integral types can be
+  // > 64 bits. So check for this and skip the size checks
+  // falling back to making a non loc return type.
+  if (ToTypeMax.getSignificantBits() > 64) {
+    return makeNonLoc(se, originalTy, castTy);
+  }
   NonLoc ToTypeMaxVal =
       makeIntVal(ToTypeMax.isUnsigned() ? ToTypeMax.getZExtValue()
----------------
vabridgers wrote:

I think I fixed this, but it seems my push may not have worked as I expected :/ Checking this.

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


More information about the cfe-commits mailing list