Commit d3d56d1 1 parent d29014e commit d3d56d1 Copy full SHA for d3d56d1
File tree 2 files changed +33
-1
lines changed
tests/regression/86-relational-array-oob
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 1
- // PARAM: --enable ana.arrayoob --enable ana.int.interval --set ana.activated[+] apron --disable warn.integer --set ana.apron.domain polyhedra
1
+ // PARAM: --enable ana.arrayoob --enable ana.int.interval --set ana.activated[+] apron --disable warn.integer
2
2
3
3
int f (char ptr [], unsigned len )
4
4
{
Original file line number Diff line number Diff line change
1
+ // SKIP PARAM: --enable ana.arrayoob --enable ana.int.interval --set ana.activated[+] apron --disable warn.integer
2
+ // This file contains known limitations of the current relational array out-of-bounds analysis.
3
+ int f (char ptr [], unsigned len )
4
+ {
5
+ for (unsigned int i = 0 ; i < len ; i ++ )
6
+ {
7
+ // due to the pointer arithmetic, the index expressions for these are `(ptr + i) - ptr` and `(ptr + i - 1U) - ptr` respectively
8
+ // We therefore fail to evalulate if this is smaller than our ghost variable
9
+ ptr [i ] = 42 ; // WARN
10
+ ptr [i - 1 ] = 42 ; // TODO NOWARN
11
+ }
12
+ }
13
+
14
+ int main ()
15
+ {
16
+ unsigned int len ;
17
+ unsigned int top ;
18
+
19
+ if (top )
20
+ len = 5 ;
21
+ else
22
+ len = 10 ;
23
+
24
+ char ptr [len ];
25
+ f (ptr + 1 , len );
26
+
27
+ char * ptr2 = ptr + 2 ;
28
+ for (unsigned int i = 0 ; i < len ; i ++ )
29
+ {
30
+ char s = ptr2 [i - 1 ]; // TODO NOWARN the index expression for this is "any_index"
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments