-
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 #1089 from goblint/access-distr
Use TrieDomain to distribute accesses to contained fields
- Loading branch information
Showing
21 changed files
with
711 additions
and
68 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,19 @@ | ||
(** Trie domains. *) | ||
|
||
module Make (Key: MapDomain.Groupable) (Value: Lattice.S) = | ||
struct | ||
module rec Trie: | ||
sig | ||
type key = Key.t | ||
type value = Value.t | ||
include Lattice.S with type t = value * ChildMap.t | ||
end = | ||
struct | ||
type key = Key.t | ||
type value = Value.t | ||
include Lattice.Prod (Value) (ChildMap) | ||
end | ||
and ChildMap: MapDomain.S with type key = Key.t and type value = Trie.t = MapDomain.MapBot (Key) (Trie) | ||
|
||
include Trie | ||
end |
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,23 @@ | ||
#include <pthread.h> | ||
#include <stdlib.h> | ||
|
||
struct S { | ||
int data; | ||
int data2; | ||
}; | ||
|
||
struct S s; | ||
|
||
void *t_fun(void *arg) { | ||
s.data = 1; // RACE! | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
struct S s2; | ||
s = s2; // RACE! | ||
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,15 @@ | ||
$ goblint --enable warn.deterministic --enable allglobs 84-distribute-fields-1.c | ||
[Warning][Race] Memory location s.data@84-distribute-fields-1.c:9:10-9:11 (race with conf. 110): | ||
write with [mhp:{tid=[main, t_fun@84-distribute-fields-1.c:18:3-18:40#top]}, thread:[main, t_fun@84-distribute-fields-1.c:18:3-18:40#top]] (conf. 110) (exp: & s.data) (84-distribute-fields-1.c:12:3-12:13) | ||
write with [mhp:{tid=[main]; created={[main, t_fun@84-distribute-fields-1.c:18:3-18:40#top]}}, thread:[main]] (conf. 110) (exp: & s) (84-distribute-fields-1.c:20:3-20:9) | ||
[Info][Race] Memory locations race summary: | ||
safe: 1 | ||
vulnerable: 0 | ||
unsafe: 1 | ||
total memory locations: 2 | ||
[Success][Race] Memory location s@84-distribute-fields-1.c:9:10-9:11 (safe): | ||
write with [mhp:{tid=[main]; created={[main, t_fun@84-distribute-fields-1.c:18:3-18:40#top]}}, thread:[main]] (conf. 110) (exp: & s) (84-distribute-fields-1.c:20:3-20:9) | ||
[Info][Deadcode] Logical lines of code (LLoC) summary: | ||
live: 8 | ||
dead: 0 | ||
total lines: 8 |
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,29 @@ | ||
#include <pthread.h> | ||
#include <stdlib.h> | ||
|
||
struct S { | ||
int data; | ||
int data2; | ||
}; | ||
|
||
struct T { | ||
struct S s; | ||
struct S s2; | ||
int data3; | ||
}; | ||
|
||
struct T t; | ||
|
||
void *t_fun(void *arg) { | ||
t.s.data = 1; // RACE! | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
pthread_t id; | ||
pthread_create(&id, NULL, t_fun, NULL); | ||
struct S s2; | ||
t.s = s2; // RACE! | ||
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,15 @@ | ||
$ goblint --enable warn.deterministic --enable allglobs 85-distribute-fields-2.c | ||
[Warning][Race] Memory location t.s.data@85-distribute-fields-2.c:15:10-15:11 (race with conf. 110): | ||
write with [mhp:{tid=[main, t_fun@85-distribute-fields-2.c:24:3-24:40#top]}, thread:[main, t_fun@85-distribute-fields-2.c:24:3-24:40#top]] (conf. 110) (exp: & t.s.data) (85-distribute-fields-2.c:18:3-18:15) | ||
write with [mhp:{tid=[main]; created={[main, t_fun@85-distribute-fields-2.c:24:3-24:40#top]}}, thread:[main]] (conf. 110) (exp: & t.s) (85-distribute-fields-2.c:26:3-26:11) | ||
[Info][Race] Memory locations race summary: | ||
safe: 1 | ||
vulnerable: 0 | ||
unsafe: 1 | ||
total memory locations: 2 | ||
[Success][Race] Memory location t.s@85-distribute-fields-2.c:15:10-15:11 (safe): | ||
write with [mhp:{tid=[main]; created={[main, t_fun@85-distribute-fields-2.c:24:3-24:40#top]}}, thread:[main]] (conf. 110) (exp: & t.s) (85-distribute-fields-2.c:26:3-26:11) | ||
[Info][Deadcode] Logical lines of code (LLoC) summary: | ||
live: 8 | ||
dead: 0 | ||
total lines: 8 |
Oops, something went wrong.