| Issue |
180054
|
| Summary |
[Thread-safety] try_acquire_capability / try_acquired_shared_capability unverified
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
bvanassche
|
The program shown below builds fine with compiler options `-Wall -Wextra -Werror -Wno-unused-parameter -fexperimental-late-parse-attributes -Wthread-safety -Wthread-safety-pointer -Wthread-safety-beta`. I think compilation should fail because neither the requirements for the try_acquire_capability attribute nor the requirements for the try_acquired_shared_capability attribute are met.
```
#include <stdbool.h>
struct __attribute__((capability("semaphore"))) semaphore;
static inline void __acquire(struct semaphore *s)
__attribute__((acquire_capability(s)))
__attribute__((no_thread_safety_analysis))
{ }
static inline void __acquire_shared(struct semaphore *s)
__attribute__((acquire_shared_capability(s)))
__attribute__((no_thread_safety_analysis))
{ }
void down_write(struct semaphore *s)
__attribute__((acquire_capability(s)))
{
__acquire(s);
}
void down_read(struct semaphore *s)
__attribute__((acquire_shared_capability(s)))
{
__acquire_shared(s);
}
_Bool down_write_trylock(struct semaphore *s)
__attribute__((try_acquire_capability(true, s)))
{
return true;
}
_Bool down_read_trylock(struct semaphore *s)
__attribute__((try_acquire_shared_capability(true, s)))
{
return true;
}
int main(int argc, char **argv)
{
return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs