Revert "[analyzer] Fix crash analyzing _BitInt() in evalIntegralCast (#65887)"

This reverts commit 4898c33527.

Lots of buildbots are failing, probably because lots of targets not supporting
large _BitInt types.
This commit is contained in:
Bjorn Pettersson 2023-09-18 23:35:48 +02:00
parent 014c41d688
commit 929662b489
2 changed files with 5 additions and 14 deletions

View File

@ -598,9 +598,11 @@ SVal SValBuilder::evalIntegralCast(ProgramStateRef state, SVal val,
APSIntType ToType(getContext().getTypeSize(castTy),
castTy->isUnsignedIntegerType());
llvm::APSInt ToTypeMax = ToType.getMaxValue();
NonLoc ToTypeMaxVal = makeIntVal(ToTypeMax);
NonLoc ToTypeMaxVal =
makeIntVal(ToTypeMax.isUnsigned() ? ToTypeMax.getZExtValue()
: ToTypeMax.getSExtValue(),
castTy)
.castAs<NonLoc>();
// Check the range of the symbol being casted against the maximum value of the
// target type.
NonLoc FromVal = val.castAs<NonLoc>();

View File

@ -1,11 +0,0 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core \
// RUN: -analyzer-checker=debug.ExprInspection \
// RUN: -verify %s
// Don't crash when using _BitInt()
// expected-no-diagnostics
_BitInt(256) a;
_BitInt(129) b;
void c() {
b = a;
}