-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
clang:static analyzergood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
Hi!
I found some suspicious behavior of clang-tidy(version 19.1.3). When I call read on the non-blocking file descriptor, it reports [clang-analyzer-unix.BlockInCriticalSection]
Here is some example code:
std::mutex mtx;
void foo()
{
std::lock_guard<std::mutex> lock(mtx);
const char *filename = "example.txt";
int fd = open(filename, O_RDONLY | O_NONBLOCK);
char buffer[200] = {};
read(fd, buffer, 199);
close(fd);
}
int main()
{
std::thread th(foo);
th.join();
return 0;
}
Metadata
Metadata
Assignees
Labels
clang:static analyzergood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute