Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/cdomains/intDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,8 @@ module Size = struct (* size in bits as int, range as int64 *)
open Cil open Big_int_Z
let sign x = if BI.compare x BI.zero < 0 then `Signed else `Unsigned

let max = function
| `Signed -> ILongLong
| `Unsigned -> IULongLong
let top_typ = TInt (ILongLong, [])
let min_for x = intKindForValue (fst (truncateCilint (max (sign x)) x)) (sign x = `Unsigned)
let min_for x = intKindForValue x (sign x = `Unsigned)
let bit = function (* bits needed for representation *)
| IBool -> 1
| ik -> bytesSizeOfInt ik * 8
Expand Down
88 changes: 88 additions & 0 deletions tests/regression/38-int-refinements/02-strange-ulong.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// PARAM: --enable ana.int.interval --set ana.int.refinement once
#include <assert.h>

int main();

int withint() {
int i = 0;
void* bla;

while(i < 10000) {
i++;
bla = &main;
}

assert(1); // reachable
return 0;
}

int withuint() {
unsigned int i = 0;
void* bla;

while(i < 10000) {
i++;
bla = &main;
}

assert(1); // reachable
return 0;
}

int withlong() {
long i = 0;
void* bla;

while(i < 10000) {
i++;
bla = &main;
}

assert(1); // reachable
return 0;
}

int withlonglong() {
long long i = 0;
void* bla;

while(i < 10000) {
i++;
bla = &main;
}

assert(1); // reachable
return 0;
}

int withulonglong() {
unsigned long long i = 0;
void* bla;

while(i < 10000) {
i++;
bla = &main;
}

assert(1); // reachable
return 0;
}

int main() {
withint();
withuint();
withlong();
withlonglong();
withulonglong();

unsigned long i = 0;
void* bla;

while(i < 10000) {
i++;
bla = &main;
}

assert(1); // reachable
return 0;
}