http://llvm.org/bugs/show_bug.cgi?id=21621
Bug ID: 21621
Summary: Race condition in ASAN with detached threads.
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: compiler-rt
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
There seems to be a race condition between when ASAN checks for leaks and when
detached threads exit and free their resources. For example the below test
detects a leak with both libc++ and libstdc++. However when the main thread
waits for the spawned thread to exit no leak is detected.
// clang++ -std=c++11 -fsanitize=address -lpthread test.cpp
#include <thread>
#include <chrono>
void func()
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
int main() {
std::thread(func).detach();
// Enable to see ASAN pass.
//std::this_thread::sleep_for(std::chrono::milliseconds(600));
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs