diff options
Diffstat (limited to 'compiler-rt/lib/tsan/lit_tests/thread_leak5.c')
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/thread_leak5.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/thread_leak5.c b/compiler-rt/lib/tsan/lit_tests/thread_leak5.c new file mode 100644 index 00000000000..fc72b149ec2 --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/thread_leak5.c @@ -0,0 +1,19 @@ +// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <unistd.h> + +void *Thread(void *x) { + return 0; +} + +int main() { + for (int i = 0; i < 5; i++) { + pthread_t t; + pthread_create(&t, 0, Thread, 0); + } + sleep(1); + return 0; +} + +// CHECK: WARNING: ThreadSanitizer: thread leak +// CHECK: And 4 more similar thread leaks |