-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1077 from goblint/pr_1007_clean
ThreadCreate analysis to improve partially context-sensitive threadID analysis
- Loading branch information
Showing
6 changed files
with
221 additions
and
10 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
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
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,32 @@ | ||
// PARAM: --disable ana.thread.context.create-edges | ||
#include <goblint.h> | ||
#include <pthread.h> | ||
|
||
int glob; | ||
|
||
void *t_FST(void *arg) { | ||
} | ||
|
||
void *t_SND(void *arg) { | ||
glob = 1; //NORACE | ||
} | ||
|
||
int nothing () { | ||
} | ||
|
||
|
||
int main() { | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_FST, NULL); | ||
|
||
nothing(); | ||
|
||
glob = 2; //NORACE | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_SND, NULL); | ||
|
||
nothing(); | ||
|
||
} |
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,76 @@ | ||
// PARAM: --disable ana.thread.context.create-edges | ||
#include <goblint.h> | ||
#include <pthread.h> | ||
|
||
int glob_noCreate; | ||
int glob_create; | ||
|
||
void *t_INIT(void *arg) { | ||
} | ||
|
||
void *t_noCreate(void *arg) { | ||
glob_noCreate =1; //NORACE | ||
} | ||
|
||
void *t_create(void *arg) { | ||
glob_create =1; //RACE | ||
} | ||
|
||
void noCreate1 () { | ||
noCreate2(); | ||
} | ||
void noCreate2 () { | ||
noCreate3(); | ||
} | ||
void noCreate3 () { | ||
noCreate4(); | ||
} | ||
void noCreate4 () { | ||
noCreate5(); | ||
} | ||
void noCreate5 () { | ||
} | ||
|
||
void create1 () { | ||
create2(); | ||
} | ||
void create2 () { | ||
create3(); | ||
} | ||
void create3 () { | ||
create4(); | ||
} | ||
void create4 () { | ||
create5(); | ||
} | ||
void create5 () { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_create, NULL); | ||
} | ||
|
||
int main() { | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_INIT, NULL); | ||
|
||
//no create | ||
noCreate1(); | ||
|
||
glob_noCreate = 2; //NORACE | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_noCreate, NULL); | ||
|
||
noCreate1(); | ||
|
||
//create | ||
create1(); | ||
|
||
glob_create = 2; //RACE | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_create, NULL); | ||
|
||
create1(); | ||
|
||
} |
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,37 @@ | ||
// PARAM: --disable ana.thread.context.create-edges | ||
#include <goblint.h> | ||
#include <pthread.h> | ||
|
||
int glob; | ||
|
||
void *t_init(void *arg) { | ||
} | ||
|
||
void *t_norace(void *arg) { | ||
glob = 1; //NORACE | ||
} | ||
|
||
void *t_other(void *arg) { | ||
} | ||
|
||
int create_other () { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_other, NULL); | ||
} | ||
|
||
|
||
int main() { | ||
//enter multithreaded mode | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_init, NULL); | ||
|
||
create_other(); | ||
|
||
glob = 2; //NORACE | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_norace, NULL); | ||
|
||
create_other(); | ||
|
||
} |
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,35 @@ | ||
// PARAM: --disable ana.thread.context.create-edges | ||
#include <goblint.h> | ||
#include <pthread.h> | ||
|
||
int glob; | ||
|
||
void *t_norace(void *arg) { | ||
glob = 1; //NORACE | ||
} | ||
|
||
void *t_other(void *arg) { | ||
} | ||
|
||
int create_other () { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_other, NULL); | ||
} | ||
|
||
void *t_fun(void *arg) { | ||
create_other(); | ||
|
||
glob = 2; //NORACE | ||
|
||
pthread_t id; | ||
pthread_create(&id, NULL, t_norace, NULL); | ||
|
||
create_other(); | ||
} | ||
|
||
int main() { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
|
||
create_other(); | ||
} |