-
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.
Merge pull request #1617 from goblint/issue_1615
Fix `thread` for non-unique spawns
- Loading branch information
Showing
3 changed files
with
61 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// PARAM: --set ana.activated[+] thread --set ana.activated[+] threadid --set ana.thread.domain plain | ||
|
||
#include <pthread.h> | ||
#include <stdio.h> | ||
|
||
int myglobal; | ||
int myglobal2; | ||
|
||
void* bla(void *arg) { | ||
// This is created multiple times, it should race with itself | ||
myglobal = 10; //RACE | ||
return NULL; | ||
} | ||
|
||
void* other(void) { | ||
// This is created only once, it should not be marked as non-unique | ||
unknown(bla); | ||
myglobal2 = 30; //NORACE | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, other, 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.context.gas_value 0 --set ana.activated[+] thread --set ana.activated[+] threadid | ||
|
||
#include <pthread.h> | ||
#include <stdio.h> | ||
|
||
int myglobal; | ||
int myglobal2; | ||
|
||
void *t_flurb(void *arg) { | ||
myglobal=40; //RACE | ||
return NULL; | ||
} | ||
|
||
void* bla(void *arg) { | ||
return NULL; | ||
} | ||
|
||
void *t_fun(void *arg) { | ||
unknown(t_flurb); // NOCRASH | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
|
||
unknown(bla); | ||
|
||
return 0; | ||
} |