Skip to content

Commit 020a1c7

Browse files
Add soundness example
1 parent 174b24b commit 020a1c7

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --set ana.relation.privatization mutex-meet-tid-cluster12
2+
#include<pthread.h>
3+
4+
int a;
5+
int b;
6+
7+
pthread_mutex_t f;
8+
9+
void nothing() {}
10+
void nothing2() {
11+
pthread_mutex_lock(&f);
12+
a = 5;
13+
b = 5;
14+
pthread_mutex_unlock(&f);
15+
}
16+
17+
18+
void main() {
19+
pthread_t tid;
20+
int x;
21+
pthread_create(&tid, 0, &nothing, NULL);
22+
23+
pthread_mutex_lock(&f);
24+
b = 5;
25+
pthread_mutex_unlock(&f);
26+
27+
pthread_t tid2;
28+
pthread_create(&tid2, 0, &nothing2, NULL);
29+
30+
pthread_mutex_lock(&f);
31+
x = a;
32+
pthread_mutex_unlock(&f);
33+
34+
__goblint_check(x == 5); //UNKNOWN!
35+
}

0 commit comments

Comments
 (0)