| Issue |
204304
|
| Summary |
Clang 22 Static Analyzer misdetects criticial section for std::unique_locks
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
jengelh
|
Version: clang version 22.1.6 with GNU libstdc++ 15.3.0 / openSUSE Tumbleweed x86_64 20260615
Input:
```c++
#include <mutex>
#include <unistd.h>
int main()
{
std::mutex m;
std::unique_lock lg(m);
lg.unlock();
sleep(1);
}
```
Observed output:
```
>clang++ 1.cpp -Wall --analyze
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
1.cpp:9:2: warning: Call to blocking function 'sleep' inside of critical section [unix.BlockInCriticalSection]
9 | sleep(1);
| ^~~~~~~~
1 warning generated.
```
Expected output:
Stay silent. The sleep occurs outside the locked section.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs