Home | History | Annotate | Download | only in lit_tests
      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>
      5 
      6 void *Thread(void *a) {
      7   ((int*)a)[0]++;
      8   return NULL;
      9 }
     10 
     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;
     18 }
     19 
     20 // CHECK: WARNING: ThreadSanitizer: data race
     21