1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
2 | |
3 | // Crashes on powerpc64be |
4 | // UNSUPPORTED: target=powerpc64{{.*}} |
5 | |
6 | #include "test.h" |
7 | |
8 | int var; |
9 | |
10 | void *Thread(void *x) { |
11 | pthread_exit(retval: &var); |
12 | return 0; |
13 | } |
14 | |
15 | int main() { |
16 | pthread_t t; |
17 | pthread_create(newthread: &t, attr: 0, start_routine: Thread, arg: 0); |
18 | void *retval = 0; |
19 | pthread_join(th: t, thread_return: &retval); |
20 | if (retval != &var) { |
21 | fprintf(stderr, format: "Unexpected return value\n" ); |
22 | exit(status: 1); |
23 | } |
24 | fprintf(stderr, format: "PASS\n" ); |
25 | return 0; |
26 | } |
27 | |
28 | // CHECK-NOT: WARNING: ThreadSanitizer: |
29 | // CHECK: PASS |
30 | |