[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 06:54:27 PDT 2024


================
@@ -121,6 +121,25 @@ struct EvalCallOptions {
   EvalCallOptions() {}
 };
 
+/// Simple control flow statements like `if` only produce a single state split,
+/// so the fact that they are included in the source code implies that both
+/// branches are possible (at least under some conditions) and the analyzer can
----------------
NagyDonat wrote:

I'm speaking about the typical usage of `if`, but this is just a side remark, so I didn't want to highlight this (the comment is already too long as it is now).

What I mean is that when the analyzer encounters an `if` __and it cannot determine whether the condition is true or false__, then it may safely assume that both branches are possible. (Which is also not entirely correct, see the `<offtopic>` block about "correlated if" problem in my top level comment -- but that's not relevant for us here.)

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


More information about the cfe-commits mailing list