]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/tsan/inlined_memcpy_race2.cc
37414ba5d3db4cb6b6d37a5730848e5fadb0a546
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
7 void *MemMoveThread(void *a
) {
8 memmove((int*)a
, z
, 16);
9 barrier_wait(&barrier
);
13 void *MemSetThread(void *a
) {
14 barrier_wait(&barrier
);
15 memset((int*)a
, 0, 16);
20 barrier_init(&barrier
, 2);
22 // Race on y between memmove and memset
23 pthread_create(&t
[0], NULL
, MemMoveThread
, y
);
24 pthread_create(&t
[1], NULL
, MemSetThread
, y
);
25 pthread_join(t
[0], NULL
);
26 pthread_join(t
[1], NULL
);
32 // CHECK: WARNING: ThreadSanitizer: data race
34 // CHECK: #1 MemSetThread
35 // CHECK: Previous write
37 // CHECK: #1 MemMoveThread