[clang] [analyzer] Mention possibility of underflow in array overflow errors (PR #84201)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 04:34:44 PST 2024


================
@@ -603,6 +611,8 @@ void ArrayBoundCheckerV2::performCheck(const Expr *E, CheckerContext &C) const {
     auto [WithinUpperBound, ExceedsUpperBound] =
         compareValueToThreshold(State, ByteOffset, *KnownSize, SVB);
 
+    bool AssumedNonNegative = SUR.assumedNonNegative();
----------------
NagyDonat wrote:

I see your point, but `CanBeNegative` is also somewhat incorrect here because at this point (in the most recent `State`) the value of the symbol cannot be negative. I think I'll use something like `AlsoMentionUnderflow` with a comment that explains its meaning.

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


More information about the cfe-commits mailing list