[clang] [analyzer] Fix null-pointer dereference in PthreadLockChecker (PR #210912)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 21 04:31:25 PDT 2026


================
@@ -493,8 +493,11 @@ void PthreadLockChecker::AcquireLockAux(const CallEvent &Call,
       default:
         llvm_unreachable("Unknown tryLock locking semantics");
       }
-      assert(lockFail && lockSucc);
-      C.addTransition(lockFail);
+      // The state where the lock failed can be infeasible if the constraint
+      // solver only now discovers a contradiction in the accumulated
+      // constraints; only take that transition when it is feasible.
----------------
steakhal wrote:

The fact that the repro doesn't crash on trunk also adds to this theory.

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


More information about the cfe-commits mailing list