[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 25 07:06:26 PDT 2024


================
@@ -697,6 +697,11 @@ void ArrayBoundCheckerV2::reportOOB(CheckerContext &C,
                                     ProgramStateRef ErrorState, Messages Msgs,
                                     NonLoc Offset, std::optional<NonLoc> Extent,
                                     bool IsTaintBug /*=false*/) const {
+  // Suppress results found through execution paths where in some loop the
+  // analyzer arbitrarily assumed either that the loop is skipped (0 iterations)
+  // or that 3 or more iterations are executed.
----------------
NagyDonat wrote:

No, the "3" comes from the fact that it's justified to assume that a loop will have at least two iterations, but it's not justified to assume that it will have at least three iterations (see my top-level comment for explanation and details).

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


More information about the cfe-commits mailing list