vsavchenko added a comment.

Hey Manas!  Great job, you put this together real quick!



================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1490
+  // the resulting range should be [Min, Max].
+  if (ResultType.isUnsigned()) {
+    return {RangeFactory, ValueFactory.getValue(Min),
----------------
Maybe you can include this as yet another condition in the next `if` statement? 
 Their bodies are identical.


================
Comment at: clang/test/Analysis/constant-folding.c:399
+    // (a - b) = [0, 5] U [UINT_MAX - 9, UINT_MAX]
+    clang_analyzer_eval((a - b) != 6); // expected-warning{{TRUE}}
+    clang_analyzer_eval((a - b) != UINT_MAX - 10); // expected-warning{{TRUE}}
----------------
Maybe you can check `(a - b) > 5 && (a - b) < UINT_MAX - 9` to cover the whole 
range?


================
Comment at: clang/test/Analysis/constant-folding.c:405
+
+  if (c >= INT_MAX - 5 && d >= INT_MAX - 5) {
+    // (c - d) = [-5, 5]
----------------
This is also Min and Max overflowing on the positive side.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105273

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to