Skip to content

Commit 3777e01

Browse files
Merge pull request #782 from goblint/issue_769
Remove erroneous call to `truncateCilint` in `min_for`
2 parents 95f1834 + d44fe5a commit 3777e01

File tree

2 files changed

+89
-4
lines changed

2 files changed

+89
-4
lines changed

src/cdomains/intDomain.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,8 @@ module Size = struct (* size in bits as int, range as int64 *)
393393
open Cil open Big_int_Z
394394
let sign x = if BI.compare x BI.zero < 0 then `Signed else `Unsigned
395395

396-
let max = function
397-
| `Signed -> ILongLong
398-
| `Unsigned -> IULongLong
399396
let top_typ = TInt (ILongLong, [])
400-
let min_for x = intKindForValue (fst (truncateCilint (max (sign x)) x)) (sign x = `Unsigned)
397+
let min_for x = intKindForValue x (sign x = `Unsigned)
401398
let bit = function (* bits needed for representation *)
402399
| IBool -> 1
403400
| ik -> bytesSizeOfInt ik * 8
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// PARAM: --enable ana.int.interval --set ana.int.refinement once
2+
#include <assert.h>
3+
4+
int main();
5+
6+
int withint() {
7+
int i = 0;
8+
void* bla;
9+
10+
while(i < 10000) {
11+
i++;
12+
bla = &main;
13+
}
14+
15+
assert(1); // reachable
16+
return 0;
17+
}
18+
19+
int withuint() {
20+
unsigned int i = 0;
21+
void* bla;
22+
23+
while(i < 10000) {
24+
i++;
25+
bla = &main;
26+
}
27+
28+
assert(1); // reachable
29+
return 0;
30+
}
31+
32+
int withlong() {
33+
long i = 0;
34+
void* bla;
35+
36+
while(i < 10000) {
37+
i++;
38+
bla = &main;
39+
}
40+
41+
assert(1); // reachable
42+
return 0;
43+
}
44+
45+
int withlonglong() {
46+
long long i = 0;
47+
void* bla;
48+
49+
while(i < 10000) {
50+
i++;
51+
bla = &main;
52+
}
53+
54+
assert(1); // reachable
55+
return 0;
56+
}
57+
58+
int withulonglong() {
59+
unsigned long long i = 0;
60+
void* bla;
61+
62+
while(i < 10000) {
63+
i++;
64+
bla = &main;
65+
}
66+
67+
assert(1); // reachable
68+
return 0;
69+
}
70+
71+
int main() {
72+
withint();
73+
withuint();
74+
withlong();
75+
withlonglong();
76+
withulonglong();
77+
78+
unsigned long i = 0;
79+
void* bla;
80+
81+
while(i < 10000) {
82+
i++;
83+
bla = &main;
84+
}
85+
86+
assert(1); // reachable
87+
return 0;
88+
}

0 commit comments

Comments
 (0)