[PATCH] D79232: [analyzer] Refactor range inference for symbolic expressions

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 15:08:45 PDT 2020


vsavchenko marked an inline comment as done.
vsavchenko added inline comments.


================
Comment at: clang/test/Analysis/constant-folding.c:127-128
+  if (a > 10) {
+    clang_analyzer_eval((a & 1) <= 1); // expected-warning{{FALSE}}
+    clang_analyzer_eval((a & 1) > 1);  // expected-warning{{FALSE}}
+  }
----------------
NoQ wrote:
> vsavchenko wrote:
> > NoQ wrote:
> > > How can both of these be false? o.o
> > Yeah :) I realized how weird it is.
> > Anything is possible in the land of infeasible ranges.
> > 
> > I changed a comment there to address this
> I mean, this pretty much never happened before. How are you not tripping on [[ https://github.com/llvm/llvm-project/blob/1a4421a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h#L100 | this assert ]]? (probably it's simply been disabled in normal debug builds now that it's under "expensive checks")
> 
> The correct thing to do is to detect the paradox earlier and mark the path as infeasible. What prevents us from doing it right away here?
Before we didn't really care about constraints on the operands and I changed it :)
So, now `Intersect` (which is logically not a correct way to do what is meant) can cause this type of behaviour


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79232





More information about the cfe-commits mailing list