Skip to content

Commit

Permalink
Merge pull request #982 from goblint/issue-968
Browse files Browse the repository at this point in the history
Improve `threadJoins` when it is used context-insensitively
  • Loading branch information
michael-schwarz authored Feb 12, 2023
2 parents 8e5dcef + a674618 commit 23abe71
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/analyses/threadJoins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ struct
| Queries.MustJoinedThreads -> (ctx.local:ConcDomain.MustThreadSet.t) (* type annotation needed to avoid "would escape the scope of its equation" *)
| _ -> Queries.Result.top q

let combine ctx (lval:lval option) fexp (f:fundec) (args:exp list) fc au =
D.union ctx.local au

let startstate v = D.top ()
let exitstate v = D.top ()
end
Expand Down
28 changes: 28 additions & 0 deletions tests/regression/51-threadjoins/06-ctxinsens.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//PARAM: --set ana.activated[+] threadJoins --set ana.ctx_insens[+] threadJoins
#include <pthread.h>

int g = 10;

void *t_fun(void *arg) {
g++; //NORACE
return NULL;
}

void benign() {
// Causes must-joined set to be empty here!
}

int main(void) {
int t;

pthread_t id;
pthread_create(&id, NULL, t_fun, NULL);

benign();
pthread_join(id, NULL);
benign();
g++; //NORACE


return 0;
}

0 comments on commit 23abe71

Please sign in to comment.