1 // RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
8 // Ensure that we can restore a stack of a finished thread.
12 void __attribute__((noinline
)) foobar(int *p
) {
16 void *Thread1(void *x
) {
21 void *Thread2(void *x
) {
29 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
30 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
31 pthread_join(t
[0], NULL
);
32 pthread_join(t
[1], NULL
);
36 // CHECK: WARNING: ThreadSanitizer: data race
37 // CHECK: Write of size 4 at {{.*}} by thread T2:
38 // CHECK: Previous write of size 4 at {{.*}} by thread T1:
41 // CHECK: Thread T1 (tid={{.*}}, finished) created by main thread at:
42 // CHECK: #0 pthread_create