Skip to content

Commit 013a6d1

Browse files
committed
Record a false negative associated with the new mutex canonicalization
1 parent 0c86e46 commit 013a6d1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/test/Analysis/block-in-critical-section-inheritance.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,17 @@ void no_false_positive_gh_104241() {
3939
m.unlock();
4040
sleep(10); // no-warning
4141
}
42+
43+
struct TwoMutexes {
44+
std::mutex m1;
45+
std::mutex m2;
46+
};
47+
48+
void two_mutexes_false_negative(TwoMutexes &tm) {
49+
tm.m1.lock();
50+
tm.m2.unlock();
51+
// Critical section is associated with tm now so tm.m1 and tm.m2 are
52+
// undistinguishiable
53+
sleep(10); // False-negative
54+
tm.m1.unlock();
55+
}

0 commit comments

Comments
 (0)