[clang] [analyzer] Fix unary/binary op support for SMT symbolic execution (PR #205078)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 29 03:13:45 PDT 2026


================
@@ -0,0 +1,13 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
+// RUN:   -analyzer-constraints=z3 -verify %s
+// REQUIRES: z3
+
+void clang_analyzer_eval(int);
+
+void unary_not_logical_result(int x, int y) {
+  clang_analyzer_eval(~(x && y) != 0); // expected-warning{{TRUE}}
+}
+
+void unary_minus_logical_result(int x, int y) {
+  clang_analyzer_eval(-(x && y) <= 0); // expected-warning{{TRUE}}
+}
----------------
steakhal wrote:

Could you please also test that everything would keep working if someone would pass `_ExtInt(256)` or `_ExtInt(300)` as operand types?

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


More information about the cfe-commits mailing list