[clang] [analyzer] Improve solver (PR #112583)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 02:09:09 PDT 2024


================
@@ -177,7 +177,8 @@ BugReportPtr BitwiseShiftValidator::checkOvershift() {
     RightOpStr = formatv(" '{0}'", ConcreteRight->getValue());
   else {
     SValBuilder &SVB = Ctx.getSValBuilder();
-    if (const llvm::APSInt *MinRight = SVB.getMinValue(FoldedState, Right)) {
+    if (const llvm::APSInt *MinRight = SVB.getMinValue(FoldedState, Right);
+        MinRight && *MinRight >= LHSBitWidth) {
----------------
NagyDonat wrote:

It's nice that this `APSInt >= unsigned` comparison works out of the box :smile:

Are you sure that it doesn't cause weird crashes? (`APSInt` is infamous for aggressive assertions on signed vs unsigned comparisons.)

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


More information about the cfe-commits mailing list