[Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
[llvm-project.git] / compiler-rt / lib / asan / tests / asan_racy_double_free_test.cpp
blob23240e714d5611c6f0cf908a6ff40ac76f0d9f0d
1 #include <pthread.h>
2 #include <stdlib.h>
3 #include <stdio.h>
5 const int N = 1000;
6 void *x[N];
8 void *Thread1(void *unused) {
9 for (int i = 0; i < N; i++) {
10 fprintf(stderr, "%s %d\n", __func__, i);
11 free(x[i]);
13 return NULL;
16 void *Thread2(void *unused) {
17 for (int i = 0; i < N; i++) {
18 fprintf(stderr, "%s %d\n", __func__, i);
19 free(x[i]);
21 return NULL;
24 int main() {
25 for (int i = 0; i < N; i++)
26 x[i] = malloc(128);
27 pthread_t t[2];
28 pthread_create(&t[0], 0, Thread1, 0);
29 pthread_create(&t[1], 0, Thread2, 0);
30 pthread_join(t[0], 0);
31 pthread_join(t[1], 0);