[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 03:55:03 PDT 2024


================
@@ -0,0 +1,16 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s \
+// RUN:  -analyzer-constraints=z3 
+
+// REQUIRES: Z3
+//
+// This LIT covers a crash associated with this test.
+// The expectation is to not crash!
+//
+
+long a;
+void b() {
+  long c;
+  if (~(b && a)) // expected-warning {{address of function 'b' will always evaluate to 'true'}}
+  // expected-note at -1 {{prefix with the address-of operator to silence this warning}}
+    c ^= 0; // expected-warning {{The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage}}
----------------
NagyDonat wrote:

It would be better to have a simpler testcase, e.g.
```c
// expected-no-diagnostics
int negate(int x) {
  return -x;
}
```
or something similar.

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


More information about the cfe-commits mailing list