[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 06:14:16 PST 2024


================
@@ -0,0 +1,31 @@
+// RUN: %clang_analyze_cc1 %s \
+// RUN:   -analyzer-checker=debug.ExprInspection \
+// RUN:   -verify
+
+void clang_analyzer_eval(int);
+
+void test_derived_sym_simplification_on_assume(int s0, int s1) {
+  int elem = s0 + s1 + 1;
+  if (elem-- == 0) // elem = s0 + s1
+    return;
+
+  if (elem-- == 0) // elem = s0 + s1 - 1
+    return;
+
+  if (s0 < 1) // s0: [1, 2147483647]
----------------
steakhal wrote:

You should use `clang_analyzer_value()` to demonstrate these ranges. That way these wouldn't ever go stale, unlike comments.

https://github.com/llvm/llvm-project/pull/115579


More information about the cfe-commits mailing list