Debian Codegraph @

gcc/testsuite/c-c++-common/tsan/thread_leak2.c

raw
1 /* { dg-shouldfail "tsan" } */
2
3 /* { dg-additional-options "-fno-unroll-loops" { target { powerpc*-*-* } } } */
4 /* -fno-unroll-loops help to avoid ThreadSanitizer reporting multi-times
5 message for pthread_create at difference calling addresses. */
6
7 #include <pthread.h>
8 #include <unistd.h>
9
10 void *Thread(void *x) {
11 return 0;
12 }
13
14 int main() {
15 int i;
16 for (i = 0; i < 5; i++) {
17 pthread_t t;
18 pthread_create(&t, 0, Thread, 0);
19 }
20 sleep(1);
21 return 0;
22 }
23
24 /* { dg-output "WARNING: ThreadSanitizer: thread leak.*(\n|\r\n|\r)" } */
25 /* { dg-output " And 4 more similar thread leaks.*" } */