[clang] [analyzer][z3] Fix crash in Z3 SMTConv when casting atomic int (PR #211489)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 23 03:08:47 PDT 2026


================
@@ -89,3 +89,14 @@ void e() {
   int f;
   a(f); // expected-warning {{1st function call argument is an uninitialized value [core.CallAndMessage]}}
 }
+
+// don't crash, and also produce a core.NullDereference finding
+_Atomic int b;
+int x;
+void k(void) {
+  int *p = 0;
+  b = x;
+  if (b == 0) {
+    *p = 1; // expected-warning {{Dereference of null pointer (loaded from variable 'p') [core.NullDereference]}}
+  }
+}
----------------
guillem-bartrina-sonarsource wrote:

I have applied all your recommendations, LMKWYT

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


More information about the cfe-commits mailing list