-
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.
Add hacky atomic relation mutex-meet privatization
- Loading branch information
Showing
6 changed files
with
218 additions
and
24 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,30 @@ | ||
// PARAM: --enable ana.sv-comp.functions --set ana.activated[+] apron --set ana.relation.privatization mutex-meet --set ana.base.privatization none | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
|
||
extern void __VERIFIER_atomic_begin(); | ||
extern void __VERIFIER_atomic_end(); | ||
|
||
int myglobal = 5; | ||
|
||
void *t_fun(void *arg) { | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 5); | ||
myglobal++; | ||
__goblint_check(myglobal == 6); | ||
myglobal--; | ||
__goblint_check(myglobal == 5); | ||
__VERIFIER_atomic_end(); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
__goblint_check(myglobal == 5); | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 5); | ||
__VERIFIER_atomic_end(); | ||
pthread_join (id, 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,30 @@ | ||
// PARAM: --enable ana.sv-comp.functions --set ana.activated[+] apron --set ana.relation.privatization mutex-meet --set ana.base.privatization none | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
|
||
int myglobal = 5; | ||
|
||
// atomic by function name prefix | ||
void __VERIFIER_atomic_fun() { | ||
__goblint_check(myglobal == 5); | ||
myglobal++; | ||
__goblint_check(myglobal == 6); | ||
myglobal--; | ||
__goblint_check(myglobal == 5); | ||
} | ||
|
||
void *t_fun(void *arg) { | ||
__VERIFIER_atomic_fun(); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
__goblint_check(myglobal == 5); | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 5); | ||
__VERIFIER_atomic_end(); | ||
pthread_join (id, 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,28 @@ | ||
// PARAM: --enable ana.sv-comp.functions --set ana.activated[+] apron --set ana.relation.privatization mutex-meet --set ana.base.privatization none | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
|
||
extern void __VERIFIER_atomic_begin(); | ||
extern void __VERIFIER_atomic_end(); | ||
|
||
int myglobal = 5; | ||
|
||
void *t_fun(void *arg) { | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 5); // TODO | ||
myglobal++; | ||
__goblint_check(myglobal == 6); // TODO | ||
__VERIFIER_atomic_end(); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
__goblint_check(myglobal == 5); // UNKNOWN! | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 5); // UNKNOWN! | ||
__VERIFIER_atomic_end(); | ||
pthread_join (id, 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,43 @@ | ||
// PARAM: --enable ana.sv-comp.functions --set ana.activated[+] apron --set ana.relation.privatization mutex-meet --set ana.base.privatization none | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
|
||
extern void __VERIFIER_atomic_begin(); | ||
extern void __VERIFIER_atomic_end(); | ||
|
||
int myglobal = 0; | ||
int myglobal2 = 0; | ||
int myglobal3 = 0; | ||
|
||
void *t_fun(void *arg) { | ||
__VERIFIER_atomic_begin(); | ||
myglobal2++; | ||
__VERIFIER_atomic_end(); | ||
__VERIFIER_atomic_begin(); | ||
myglobal++; | ||
__VERIFIER_atomic_end(); | ||
return NULL; | ||
} | ||
|
||
void *t2_fun(void *arg) { | ||
__VERIFIER_atomic_begin(); | ||
myglobal3++; | ||
__VERIFIER_atomic_end(); | ||
__VERIFIER_atomic_begin(); | ||
myglobal++; | ||
__VERIFIER_atomic_end(); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id, id2; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
pthread_create(&id2, NULL, t2_fun, NULL); | ||
__goblint_check(myglobal == 2); // UNKNOWN! | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 2); // UNKNOWN! | ||
__VERIFIER_atomic_end(); | ||
pthread_join (id, NULL); | ||
pthread_join (id2, 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,23 @@ | ||
// PARAM: --enable ana.sv-comp.functions --set ana.activated[+] apron --set ana.relation.privatization mutex-meet --set ana.base.privatization none | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
|
||
extern void __VERIFIER_atomic_begin(); | ||
extern void __VERIFIER_atomic_end(); | ||
|
||
int myglobal = 5; | ||
|
||
void *t_fun(void *arg) { | ||
myglobal++; | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
__VERIFIER_atomic_begin(); | ||
__goblint_check(myglobal == 5); // UNKNOWN! | ||
__VERIFIER_atomic_end(); | ||
pthread_join (id, NULL); | ||
return 0; | ||
} |