repo.or.cz
/
blocksruntime.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git]
/
test
/
tsan
/
heap_race.cc
blob
cc2c1fee532bda6a699e028845c6187d7108ad8b
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