Skip to content

Commit 7f8d909

Browse files
Test to detect incorrect relabelling of properties after slicing
1 parent c392312 commit 7f8d909

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

regression/cbmc/full_slice2/main.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <assert.h>
2+
3+
typedef enum {
4+
A,
5+
B,
6+
C
7+
} node_t;
8+
9+
void doit(node_t *node);
10+
11+
static inline void foo(node_t *node) { }
12+
static inline void bar(node_t *node) { }
13+
14+
void doit(node_t *node)
15+
{
16+
switch (*node)
17+
{
18+
case A:
19+
foo(node);
20+
*node=B;
21+
bar(node);
22+
return;
23+
case C:
24+
*node=B;
25+
bar(node);
26+
return;
27+
}
28+
}
29+
30+
int main()
31+
{
32+
node_t node=A;
33+
34+
assert(&node);
35+
36+
char count=0;
37+
while(count++<10)
38+
{
39+
char c;
40+
41+
doit(&node);
42+
43+
static char q=0;
44+
q=0;
45+
46+
if(c==0)
47+
{
48+
assert(node==A);
49+
}
50+
}
51+
52+
return 0;
53+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--full-slice --property main.assertion.2 --unwind 1
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED
7+
--
8+
^warning: ignoring
9+
--
10+
Tests whether properties are not relabelled after slicing.

0 commit comments

Comments
 (0)