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
[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git]
/
test
/
tsan
/
stack_race.cc
blob
90da2f8c82709f0781c3edca6692749f080dd972
1
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
#include <pthread.h>
3
#include <stddef.h>
4
#include <unistd.h>
5
6
void
*
Thread
(
void
*
a
) {
7
sleep
(
1
);
8
*(
int
*)
a
=
43
;
9
return
0
;
10
}
11
12
int
main
() {
13
int
Var
=
42
;
14
pthread_t t
;
15
pthread_create
(&
t
,
0
,
Thread
, &
Var
);
16
Var
=
43
;
17
pthread_join
(
t
,
0
);
18
}
19
20
// CHECK: WARNING: ThreadSanitizer: data race
21
// CHECK: Location is stack of main thread.
22