[PATCH] D39707: [analyzer] assume bitwise arithmetic axioms

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 7 06:04:15 PST 2017


NoQ accepted this revision.
NoQ added a comment.

Yep, nice and clean~



================
Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:520
 
+  Result = applyBitwiseConstraints(BV, F, T, Result, Sym);
   return Result;
----------------
That's more and more "special case"s, i guess we'd have to make them legal. The `getRange()` function is not only a simple wrapper around `State->get<>()`, but it is also the single source of truth regarding constraints that can be assumed about the values by simply looking at the values, without exploring the program state. I think this should be reflected in the comments.


================
Comment at: test/Analysis/constant-folding.c:92
+  clang_analyzer_eval((b | 1) > 0); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval((b | 1) == 0); // expected-warning{{UNKNOWN}}
+
----------------
Can we still assume that `b | 1` is non-zero? Maybe FIXME here?


https://reviews.llvm.org/D39707





More information about the cfe-commits mailing list