-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Construct feasible races-mhp regression tests for improved history th…
…read ID may_create
- Loading branch information
Showing
6 changed files
with
159 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// PARAM: --set ana.activated[+] mhp --disable ana.thread.include-node | ||
#include <pthread.h> | ||
|
||
int g; | ||
|
||
void *b(void *arg) { | ||
int *gp = arg; | ||
if (gp) | ||
(*gp)++; // NORACE | ||
return NULL; | ||
} | ||
|
||
void *a(void *arg) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, b, arg); | ||
return NULL; | ||
} | ||
|
||
int main() { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, b, NULL); | ||
g++; // NORACE | ||
pthread_create(&id2, NULL, a, &g); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// PARAM: --set ana.activated[+] mhp --disable ana.thread.include-node | ||
#include <pthread.h> | ||
|
||
int g; | ||
|
||
void *a(void *arg) { | ||
int *gp = arg; | ||
if (gp) | ||
(*gp)++; // RACE (self-race in non-unique thread) | ||
return NULL; | ||
} | ||
|
||
void *b(void *arg) { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, a, NULL); | ||
pthread_create(&id2, NULL, a, &g); | ||
return NULL; | ||
} | ||
|
||
|
||
int main() { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, a, NULL); | ||
g++; // NORACE | ||
pthread_create(&id2, NULL, b, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// PARAM: --set ana.activated[+] mhp --disable ana.thread.include-node | ||
#include <pthread.h> | ||
|
||
int g; | ||
|
||
void *d(void *arg) { | ||
int *gp = arg; | ||
if (gp) | ||
(*gp)++; // RACE (self-race in non-unique thread) | ||
return NULL; | ||
} | ||
|
||
void *c(void *arg) { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, d, NULL); | ||
pthread_create(&id2, NULL, d, &g); | ||
return NULL; | ||
} | ||
|
||
void *b(void *arg) { | ||
return NULL; | ||
} | ||
|
||
void *a(void *arg) { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, b, NULL); | ||
g++; // NORACE | ||
pthread_create(&id2, NULL, c, NULL); | ||
return NULL; | ||
} | ||
|
||
int main() { | ||
pthread_t id; | ||
pthread_create(&id, NULL, a, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// PARAM: --set ana.activated[+] mhp --disable ana.thread.include-node | ||
#include <pthread.h> | ||
|
||
int g; | ||
|
||
void *a(void *arg) { | ||
int *gp = arg; | ||
if (gp) | ||
(*gp)++; // RACE (self-race in non-unique thread) | ||
return NULL; | ||
} | ||
|
||
void *b(void *arg) { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, a, NULL); | ||
pthread_create(&id2, NULL, a, &g); | ||
return NULL; | ||
} | ||
|
||
int main() { | ||
pthread_t id, id2, id3; | ||
pthread_create(&id, NULL, a, NULL); | ||
pthread_create(&id, NULL, a, NULL); | ||
g++; // NORACE | ||
pthread_create(&id, NULL, b, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// PARAM: --set ana.activated[+] mhp --disable ana.thread.include-node | ||
#include <pthread.h> | ||
|
||
int g; | ||
|
||
void *b(void *arg) { | ||
return NULL; | ||
} | ||
|
||
void *c(void *arg) { | ||
int *gp = arg; | ||
if (gp) | ||
(*gp)++; // RACE (self-race in non-unique thread) | ||
return NULL; | ||
} | ||
|
||
void *a(void *arg) { | ||
pthread_t id, id2, id3, id4; | ||
pthread_create(&id, NULL, b, NULL); | ||
pthread_create(&id2, NULL, b, NULL); | ||
g++; // NORACE | ||
pthread_create(&id, NULL, c, NULL); | ||
pthread_create(&id2, NULL, c, &g); | ||
return NULL; | ||
} | ||
|
||
int main() { | ||
pthread_t id; | ||
pthread_create(&id, NULL, a, NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters