]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/tsan/inlined_memcpy_race.cc
720f2bfcac8c00abef78c1adcca781a49e174663
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
7 void *MemCpyThread(void *a
) {
8 memcpy((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 x between memcpy and memset
23 pthread_create(&t
[0], NULL
, MemCpyThread
, x
);
24 pthread_create(&t
[1], NULL
, MemSetThread
, x
);
25 pthread_join(t
[0], NULL
);
26 pthread_join(t
[1], NULL
);
31 // CHECK: WARNING: ThreadSanitizer: data race
33 // CHECK: #1 MemSetThread
34 // CHECK: Previous write
35 // CHECK: #0 {{(memcpy|memmove)}}
36 // CHECK: #1 MemCpyThread