[PATCH] D98504: [clang][Checkers] Fix PthreadLockChecker state cleanup at dead symbol.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 12 21:46:35 PST 2021


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Hmm this probably even deserves a warning? Like, the mutex goes out of scope but we don't know whether we've successfully destroyed it? Even if we perform the check later, we can't do anything about it anymore? (not sure how bad it is in practice)



================
Comment at: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:290-304
   // Existence in DestroyRetVal ensures existence in LockMap.
   // Existence in Destroyed also ensures that the lock state for lockR is either
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
   assert(lstate->isUntouchedAndPossiblyDestroyed() ||
          lstate->isUnlockedAndPossiblyDestroyed());
 
   ConstraintManager &CMgr = state->getConstraintManager();
----------------
ASDenysPetrov wrote:
> I'm just wondering, did you think about such way of fixing?
This involves keeping dead regions in the program state. I'd be pretty worried about it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98504/new/

https://reviews.llvm.org/D98504



More information about the cfe-commits mailing list