| // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s |
| // Ensure that we can restore a stack of a finished thread. |
| void __attribute__((noinline)) foobar(int *p) { |
| sleep(1); // let the thread finish and exit |
| barrier_init(&barrier, 2); |
| pthread_create(&t[0], NULL, Thread1, NULL); |
| pthread_create(&t[1], NULL, Thread2, NULL); |
| pthread_join(t[0], NULL); |
| pthread_join(t[1], NULL); |
| // CHECK: WARNING: ThreadSanitizer: data race |
| // CHECK: Write of size 4 at {{.*}} by thread T2: |
| // CHECK: Previous write of size 4 at {{.*}} by thread T1: |
| // CHECK: Thread T1 (tid={{.*}}, finished) created by main thread at: |
| // CHECK: #0 pthread_create |