[PATCH] D105273: [analyzer] Introduce range-based reasoning for subtraction operator

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 2 11:56:23 PDT 2021


vsavchenko added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1485
+  if (ResultType.isUnsigned() ||
+      ((LHS.From() >= 0 && RHS.From() < 0) &&
+       (LHS.To() >= 0 && RHS.To() < 0)) ||
----------------
manas wrote:
> @vsavchenko one thing crossed my mind is that, shouldn't I compare `From` and `To` values with  `llvm::APSInt Zero = ValueFactory.getAPSIntType(T).getZeroValue()` instead of literal `0`?
Yes!  Thanks for noticing this (the same goes to the other patch as well)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105273/new/

https://reviews.llvm.org/D105273



More information about the cfe-commits mailing list