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

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 28 05:57:30 PDT 2020


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


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:506-507
+  ///
+  /// where abs(Origin) is the maximal absolute value of any possible values
+  ///       from Origin, and min(T) is a minimal value for the type T.
+  ///
----------------
NoQ wrote:
> I suggest not trying to express signed types and unsigned types in a single formula, the reader will have to unwrap it back into the two cases anyway in order to understand what's going on.
> 
> The following would imho be easier to read: "If T is signed, return the smallest range `[-x..x]` that covers the original range, or `[-min(T), max(T)]` if the aforementioned symmetric range doesn't exist due to original range covering `min(T)`). If T is unsigned, return the smallest range `[0..x]` that covers the original range".
That is a perfect explanation, thanks!


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