[PATCH] D79336: [analyzer] Generalize bitwise OR rules for ranges

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 10:09:40 PDT 2020


vsavchenko created this revision.
vsavchenko added reviewers: NoQ, dcoughlin.
Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: clang.
vsavchenko added a comment.

Here is a little proof I've put together (using Z3): https://gist.github.com/SavchenkoValeriy/9ad6ca72e7420fd5612e618187bd4f76


Previously the current solver started reasoning about bitwise OR
expressions only when one of the operands is a constant.  However,
very similar logic could be applied to ranges.  This commit addresses
this shortcoming.  Additionally, it refines how we deal with negative
operands.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79336

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/test/Analysis/constant-folding.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79336.261852.patch
Type: text/x-patch
Size: 11179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200504/c0995cb5/attachment-0001.bin>


More information about the cfe-commits mailing list