[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / tsan / free_race2.c
blob2b979f3111994eabd10a5dec2490ef3945d659b9
1 // RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 #include <stdlib.h>
4 void __attribute__((noinline)) foo(int *mem) {
5 free(mem);
8 void __attribute__((noinline)) bar(int *mem) {
9 mem[0] = 42;
12 int main() {
13 int *mem = (int*)malloc(100);
14 foo(mem);
15 bar(mem);
16 return 0;
19 // CHECK: WARNING: ThreadSanitizer: heap-use-after-free
20 // CHECK: Write of size 4 at {{.*}} by main thread:
21 // CHECK: #0 bar
22 // CHECK: #1 main
23 // CHECK: Previous write of size 8 at {{.*}} by main thread:
24 // CHECK: #0 free
25 // CHECK: #{{1|2}} foo
26 // CHECK: #{{2|3}} main