================
@@ -7675,4 +7675,25 @@ void testLoopConditionalReassignment(Foo *f1, Foo *f2,
bool cond) {
f1->data = 42;
ptr->mu.Unlock(); // expected-warning{{releasing mutex 'ptr->mu' that was
not held}}
} // expected-warning{{mutex 'f1->mu' is still held at the end of function}}
+
+
+void unlock_Foo(Foo **Fp) __attribute__((release_capability((*Fp)->mu)));
+// A function that may do anything to the objects referred to by the inputs:
+void f(void *, void *, void *);
+
+void saveContexBug(Foo *F)
+{
+ Foo *L;
+ L = F;
+ L->mu.Lock(); // expected-note{{mutex acquired here}}
+ Foo ** Fp = &L;
----------------
melver wrote:
Why does this need to be a pointer-to-pointer. Won't this be enough to trigger
the bug:
```
Foo *M = L;
...
f(&L, &L, &M);
M->mu.Unlock();
```
?
https://github.com/llvm/llvm-project/pull/178825
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits