[PATCH] D65239: [analyzer] RangeConstraintManager: Apply constraint ranges of bitwise operations
Csaba Dabis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 16:16:50 PDT 2019
Charusso added a comment.
In overall I wanted to keep the [A, B] shape of the tests, but now they are more precise, thanks!
================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:503
+
+ if (!BinaryOperator::isBitwiseOrShiftOp(SIE->getOpcode()))
+ return State;
----------------
NoQ wrote:
> I suspect we have problems with bitwise OR here, which (unlike other bitwise/shift ops) may be true when the LHS is 0.
Whoops, thanks!
================
Comment at: clang/test/Analysis/bitwise-ranges.cpp:28
+ unsigned int D = X << 1;
+ clang_analyzer_eval((D >= 1 && D <= 4294967295) || D == 0);
+ // expected-warning at -1 {{TRUE}}
----------------
NoQ wrote:
> This check is trivially true regardless of the value of D or constraints on it.
Hm, yes. I felt like `D` equals to `E`, but that test fails, so I have just removed them.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65239/new/
https://reviews.llvm.org/D65239
More information about the cfe-commits
mailing list