Skip to content

Commit 3eff22f

Browse files
Make comparison of pointers amenable to meet if they only differ in offsets
1 parent c1b7284 commit 3eff22f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/cdomain/value/cdomains/addressDomain.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ struct
112112

113113
let amenable_to_meet x y = match x,y with
114114
| StrPtr _, StrPtr _ -> true
115+
| Addr x, Addr y when Mval.equal (Mval.top_indices x) (Mval.top_indices y) -> true
115116
| _ -> false
116117

117118
let leq x y = match x, y with
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//PARAM: --enable ana.int.interval
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
#include <time.h>
5+
6+
7+
int main() {
8+
int arr[20];
9+
10+
int top;
11+
12+
int i = 2;
13+
if(top) {
14+
i = 8;
15+
}
16+
17+
int* imprecise = &arr[i];
18+
19+
if(imprecise == &arr[2]) {
20+
__goblint_check(imprecise == &arr[2]);
21+
}
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)