Skip to content

Commit

Permalink
Add test for fresh alloca
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Jan 11, 2024
1 parent 910b152 commit 8c85984
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/regression/45-escape/49-fresh-alloca.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// PARAM: --set ana.activated[+] mallocFresh --set ana.activated[-] mhp --set ana.thread.domain plain
#include <pthread.h>
#include <stdlib.h>

pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;

void *t_fun2(void *arg) {
int *i = arg;
pthread_mutex_lock(&A);
*i = 10; // NORACE
pthread_mutex_unlock(&A);
return NULL;
}

void *t_fun(void *arg) {
return NULL;
}

int main() {
pthread_t id, id2;
pthread_create(&id, NULL, t_fun, NULL); // enter multithreaded

int *i = alloca(sizeof(int));
*i = 5; // NORACE (fresh)
pthread_create(&id2, NULL, t_fun2, i);
return 0;
}

0 comments on commit 8c85984

Please sign in to comment.