Debian Codegraph @

compiler-rt/test/hwasan/TestCases/pthread_create.c

raw
1 // Tests that our thread initialization hooks work properly with random_tags=1.
2 // RUN: %clang_hwasan %s -o %t
3 // RUN: %env_hwasan_opts=random_tags=1 %run %t
4
5 #include <pthread.h>
6
7 #include <sanitizer/hwasan_interface.h>
8
9 volatile int state;
10
11 void *Increment(void *arg) {
12 ++state;
13 return NULL;
14 }
15
16 int main() {
17 __hwasan_enable_allocator_tagging();
18 pthread_t t1;
19 pthread_create(&t1, NULL, Increment, NULL);
20 pthread_join(t1, NULL);
21 }