[PATCH] D80117: [analyzer] Introduce reasoning about symbolic remainder operator

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


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


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:462
+    if (CoversTheWholeType) {
+      return {ValueFactory.getMinValue(RangeType),
+              ValueFactory.getMaxValue(RangeType)};
----------------
NoQ wrote:
> vsavchenko wrote:
> > NoQ wrote:
> > > You mean zero, right?
> > No, not always.  It still can be signed at this point.
> Ok, so i misunderstood. This function computes range of `abs($x)` aka `|$x|` given the range for `$x`, right?
I guess I should fix my comments (and maybe the name for this function).
This function finds absolute maximum, i.e. the value `C: |$x| <= C` and returns the range `[-C, C]` for signed `$x`s and `[0, C]` for unsigned `$x`s.

So this new range is guaranteed to include the original range.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80117





More information about the cfe-commits mailing list