[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git] / test / tsan / heap_race.cc
blobcc2c1fee532bda6a699e028845c6187d7108ad8b
1 // RUN: %clangxx_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <stddef.h>
6 void *Thread(void *a) {
7 ((int*)a)[0]++;
8 return NULL;
11 int main() {
12 int *p = new int(42);
13 pthread_t t;
14 pthread_create(&t, NULL, Thread, p);
15 p[0]++;
16 pthread_join(t, NULL);
17 delete p;
20 // CHECK: WARNING: ThreadSanitizer: data race