================ @@ -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() ---------------- DonatNagyE wrote:
The root cause of this issue is an unnecessary back-and-forth conversion. The `nonloc::ConcreteInt` that we construct here will use an `APSInt` to represent its value, so there is no real need to convert our `APSInt` to an `uint64_t` which will be used to construct a new `APSInt`. Instead of adding a special case early return, simply switch to using the method ```c++ nonloc::ConcreteInt makeIntVal(const llvm::APSInt& integer); ``` which significantly simplifies this part of the code and eliminates the crash on huge values. https://github.com/llvm/llvm-project/pull/65887 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits