Skip to content

Commit ea11726

Browse files
committed
added test for values in traces
1 parent c269ca5 commit ea11726

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
int global_var;
2+
3+
struct S
4+
{
5+
int f;
6+
int array[3];
7+
} my_nested[2];
8+
9+
int main()
10+
{
11+
static int static_var;
12+
int local_var;
13+
int *p=&my_nested[0].array[1];
14+
int *q=&my_nested[1].f;
15+
int *null=0;
16+
int *junk;
17+
18+
global_var=1;
19+
static_var=2;
20+
local_var=3;
21+
*p=4;
22+
*q=5;
23+
*null=6;
24+
*junk=7;
25+
26+
// dynamic
27+
p=malloc(sizeof(int)*2);
28+
p[1]=8;
29+
30+
// not even a pointer variable
31+
*(int *)0=9;
32+
33+
// assign entire struct
34+
my_nested[1]=my_nested[0];
35+
36+
// get a trace
37+
__CPROVER_assert(0, "");
38+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
trace-values.c
3+
--trace
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^ local_var=0 .*$
7+
^ global_var=1 .*$
8+
^ static_var=2 .*$
9+
^ local_var=3 .*$
10+
^ my_nested\[0.*\].array\[1.*\]=4 .*$
11+
^ my_nested\[1.*\].f=5 .*$
12+
^ null\$object=6 .*$
13+
^ junk\$object=7 .*$
14+
^ dynamic_object1\[1.*\]=8 .*$
15+
^ my_nested\[1.*\]={ .f=0, .array={ 0, 4, 0 } } .*$
16+
^VERIFICATION FAILED$
17+
--
18+
^warning: ignoring

0 commit comments

Comments
 (0)