[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git] / test / tsan / malloc_stack.cc
blob3603497ef311a2a18fe8e7c27982ee3d01fa17ef
1 // RUN: %clang_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
2 #include <pthread.h>
3 #include <unistd.h>
5 _Atomic(int*) p;
7 void *thr(void *a) {
8 sleep(1);
9 int *pp = __c11_atomic_load(&p, __ATOMIC_RELAXED);
10 *pp = 42;
11 return 0;
14 int main() {
15 pthread_t th;
16 pthread_create(&th, 0, thr, p);
17 __c11_atomic_store(&p, new int, __ATOMIC_RELAXED);
18 pthread_join(th, 0);
21 // CHECK: data race
22 // CHECK: Previous write
23 // CHECK: #0 operator new
24 // CHECK: Location is heap block
25 // CHECK: #0 operator new