Skip to content

Commit 0db8fea

Browse files
committed
Replace violation cram test
1 parent 4640382 commit 0db8fea

File tree

3 files changed

+79
-102
lines changed

3 files changed

+79
-102
lines changed

tests/regression/witness/violation.t/callfpointer.c

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
extern void abort(void);
2+
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
3+
void reach_error() { __assert_fail("0", "nec11.c", 3, "reach_error"); }
4+
5+
void __VERIFIER_assert(int cond) {
6+
if (!(cond)) {
7+
ERROR: {reach_error();abort();}
8+
}
9+
return;
10+
}
11+
12+
_Bool __VERIFIER_nondet_bool();
13+
14+
int main(){
15+
int a[5];
16+
int len=0;
17+
_Bool c=__VERIFIER_nondet_bool();
18+
int i;
19+
20+
21+
while(c){
22+
23+
if (len==4)
24+
len =0;
25+
26+
a[len]=0;
27+
28+
len++;
29+
}
30+
__VERIFIER_assert(len==5);
31+
return 1;
32+
33+
34+
}
Lines changed: 45 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,22 @@
1-
$ goblint --conf svcomp25.json --disable ana.autotune.enabled --set ana.specification "CHECK( init(main()), LTL(G ! call(reach_error())) )"} callfpointer.c --enable exp.arg.stack --enable exp.arg.enabled --set exp.arg.dot.path arg.dot --set exp.arg.dot.node-label empty --enable ana.wp --set witness.yaml.entry-types[+] violation_sequence --enable witness.yaml.sv-comp-true-only --enable witness.invariant.other
1+
$ goblint --conf svcomp25.json --disable ana.autotune.enabled --set ana.specification "CHECK( init(main()), LTL(G ! call(reach_error())) )"} nec11.c --enable exp.arg.enabled --enable ana.wp --set witness.yaml.entry-types[+] violation_sequence --enable witness.yaml.sv-comp-true-only --enable witness.invariant.other
22
[Info] SV-COMP specification: CHECK( init(main()), LTL(G ! call(reach_error())) )
3-
[Warning][Deadcode] Function 'main' does not return
4-
[Warning][Deadcode] Function 'f' has dead code:
5-
on line 8 (callfpointer.c:8-8)
6-
[Warning][Deadcode] Function 'h' has dead code:
7-
on line 16 (callfpointer.c:16-16)
8-
[Warning][Deadcode] Function 'main' has dead code:
9-
on line 20 (callfpointer.c:20-20)
10-
[Warning][Deadcode] Logical lines of code (LLoC) summary:
11-
live: 8
12-
dead: 3
13-
total lines: 11
14-
[Warning][Deadcode][CWE-571] condition 'i == 1' is always true (callfpointer.c:11:5-11:9)
3+
[Warning][Integer > Overflow][CWE-190] Signed integer overflow (nec11.c:28:7-28:12)
4+
[Info][Deadcode] Logical lines of code (LLoC) summary:
5+
live: 16
6+
dead: 0
7+
total lines: 16
158
SV-COMP result: unknown
169

17-
$ graph-easy --as=boxart arg.dot
18-
┌──────────────────────┐
19-
│ _ │
20-
└──────────────────────┘
21-
22-
│ Entry main
23-
24-
┌──────────────────────┐
25-
│ _ │
26-
└──────────────────────┘
27-
28-
│ InlineEntry '(& h)'
29-
30-
┌──────────────────────┐
31-
│ _ │
32-
└──────────────────────┘
33-
34-
│ Entry f
35-
36-
┌──────────────────────┐
37-
│ _ │
38-
└──────────────────────┘
39-
40-
│ InlineEntry '(1)'
41-
42-
┌──────────────────────┐
43-
│ _ │
44-
└──────────────────────┘
45-
46-
│ Entry h
47-
48-
┌──────────────────────┐
49-
│ _ │
50-
└──────────────────────┘
51-
52-
Test (i == 1,true)
53-
54-
┌──────────────────────┐
55-
│ _ │
56-
└──────────────────────┘
57-
58-
│ InlineEntry '()'
59-
60-
┌──────────────────────┐
61-
│ _ │
62-
└──────────────────────┘
63-
64-
│ Entry reach_error
65-
66-
┌──────────────────────┐
67-
│ _ │
68-
└──────────────────────┘
69-
7010
$ yamlWitnessStrip < witness.yml
7111
- entry_type: violation_sequence
7212
content:
7313
- segment:
7414
- waypoint:
7515
type: assumption
7616
location:
77-
file_name: callfpointer.c
78-
line: 18
79-
column: 2
17+
file_name: nec11.c
18+
line: 16
19+
column: 4
8020
function: main
8121
action: follow
8222
constraint:
@@ -86,10 +26,10 @@
8626
- waypoint:
8727
type: assumption
8828
location:
89-
file_name: callfpointer.c
90-
line: 7
91-
column: 2
92-
function: f
29+
file_name: nec11.c
30+
line: 17
31+
column: 4
32+
function: main
9333
action: follow
9434
constraint:
9535
value: "1"
@@ -98,10 +38,34 @@
9838
- waypoint:
9939
type: branching
10040
location:
101-
file_name: callfpointer.c
102-
line: 11
103-
column: 2
104-
function: h
41+
file_name: nec11.c
42+
line: 21
43+
column: 4
44+
function: main
45+
action: follow
46+
constraint:
47+
value: "false"
48+
format: c_expression
49+
- segment:
50+
- waypoint:
51+
type: assumption
52+
location:
53+
file_name: nec11.c
54+
line: 30
55+
column: 4
56+
function: main
57+
action: follow
58+
constraint:
59+
value: "1"
60+
format: c_expression
61+
- segment:
62+
- waypoint:
63+
type: branching
64+
location:
65+
file_name: nec11.c
66+
line: 6
67+
column: 3
68+
function: __VERIFIER_assert
10569
action: follow
10670
constraint:
10771
value: "true"
@@ -110,8 +74,8 @@
11074
- waypoint:
11175
type: target
11276
location:
113-
file_name: callfpointer.c
114-
line: 12
115-
column: 11
116-
function: h
77+
file_name: nec11.c
78+
line: 7
79+
column: 13
80+
function: __VERIFIER_assert
11781
action: follow

0 commit comments

Comments
 (0)