1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 // RUN: %clang_tsan -O1 -DACCESS_OFFSET=4 %s -o %t && %deflake %run %t | FileCheck %s
6 #define ACCESS_OFFSET 0
9 __attribute__((noinline
)) void foo(void *mem
) {
13 __attribute__((noinline
)) void baz(void *mem
) {
17 __attribute__((noinline
)) void bar(void *mem
) {
18 *(long*)((char*)mem
+ ACCESS_OFFSET
) = 42;
22 void *mem
= malloc(100);
30 // CHECK: WARNING: ThreadSanitizer: heap-use-after-free
31 // CHECK: Write of size {{.*}} at {{.*}} by main thread:
34 // CHECK: Previous write of size 8 at {{.*}} by main thread:
36 // CHECK: #{{1|2}} foo
37 // CHECK: #{{2|3}} main