[PATCH] D21506: [analyzer] Block in critical section

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 11:48:44 PDT 2016


NoQ added a comment.

I think there's still this problem i've outlined in the comment above: you can step into an integer-underflow if your analysis begins with unlock(). You could just ignore all unlocks that move you below 0, which would be ok.

Could you add this test?

  std::mutex m;
  void foo() {
    m.unlock(); // MutexCount = 4294967295, should be 0, just ignore this unlock.
    sleep(1); // no-warning
    m.lock(); // MutexCount = 0, should be 1, woohoo we're sure we're in the section now.
    // What's the current mutex count?
    sleep(1); // expected-warning{{}}
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D21506





More information about the cfe-commits mailing list