Skip to content

Commit

Permalink
add test case 86 04 again
Browse files Browse the repository at this point in the history
  • Loading branch information
FungOliver committed Feb 9, 2024
1 parent 0fbb0cd commit a80f248
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/regression/86-relational-array-oob/04-global2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// PARAM: --enable ana.arrayoob --enable ana.int.interval --set ana.activated[+] apron --disable warn.integer --set ana.apron.domain polyhedra

int readUntil(char ptr[], unsigned len)
{
for (unsigned int i = 0; i < len; i++)
{
char s = ptr[0]; // NOWARN
char s = ptr[i ]; // WARN

ptr[i] = 42; // NOWARN
ptr[i - 1] = 42; // WARN
}
}

int main()
{
unsigned int len;
unsigned int top;

if (top)
len = 5;
else
len = 10;

char ptr[len];
char *ptr2 = ptr+7;
readUntil(ptr, len);

for (unsigned int i = 0; i < len; i++)
{
char s = ptr[i]; // NOWARN
char s = ptr[i - 1]; // WARN
char s = ptr[i + 1]; // WARN
char s = ptr[i - i]; // NOWARN
char s = ptr[i + i]; // WARN

ptr[i] = 42; // NOWARN
ptr[i - 1] = 42; // WARN
ptr[i + 1] = -42; // WARN
ptr[i + i] = -42; // WARN
}
}

0 comments on commit a80f248

Please sign in to comment.