[clang] [analyzer] Correct crash in Z3 wrapper (PR #158276)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 13 03:46:49 PDT 2025


================
@@ -13,3 +13,29 @@ int negate(int x, int y) {
     return 0;
   return 1;
 }
+
+void c();
+void case004(int *a, int *b) {
+  void *e;
+  b != a;
+  c(e); // expected-warning{{1st function call argument is an uninitialized value}}
+}
+
+void z3crash(int a, int b) {
+  b = a || b;
+  (-b == a) / a; // expected-warning{{expression result unused}}
+                 // expected-warning at -1{{Division by zero [core.DivideZero]}}
+}
+
+void z3_nocrash(float a, float b) {
+  b = a || b;
+  (-b == a) / a; // expected-warning{{expression result unused}}
+}
+
+void z3_crash2(int a) {
+  if (-(&c && a)) {
+    int *d;
+    *d; // expected-warning{{Dereference of undefined pointer value}}
+        // expected-warning at -1{{expression result unused}}
----------------
vabridgers wrote:

Understood, I'll address

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


More information about the cfe-commits mailing list