Skip to content
This repository was archived by the owner on Oct 3, 2021. It is now read-only.

Commit 506605c

Browse files
authored
Merge pull request #1191 from MartinSpiessl/zilu-fix
Zilu fix
2 parents c9c19b2 + 10e57e7 commit 506605c

File tree

165 files changed

+4066
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+4066
-0
lines changed

.reuse/dep5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Files:
9292
c/loop-lit
9393
c/loop-new
9494
c/loop-simple
95+
c/loop-zilu
9596
c/loops-crafted-1
9697
c/memory-alloca
9798
c/memsafety

c/NoOverflows-Other.set

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ recursive/*.yml
33
recursive-simple/*.yml
44
bitvector/*.yml
55
psyco/*.yml
6+
loop-zilu/*.yml

c/ReachSafety-Loops.set

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ loop-industry-pattern/*.yml
99
loops-crafted-1/*.yml
1010
loop-invariants/*.yml
1111
loop-simple/*.yml
12+
loop-zilu/*.yml
1213
verifythis/duplets.yml
1314
verifythis/elimination_max.yml
1415
verifythis/lcp.yml

c/loop-zilu/LICENSE.GPLv2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE.GPLv2.txt

c/loop-zilu/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LEVEL := ../
2+
3+
include $(LEVEL)/Makefile.config

c/loop-zilu/README.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
These tasks were generated by Martin Spiessl
2+
from information in the tool repository of zilu,
3+
a tool for invariant generation throug selective sampling,
4+
which is described in the following publication:
5+
6+
Li, J., Sun, J., Li, L., Le, Q. L., & Lin, S. W. (2017, October).
7+
Automatic loop-invariant generation anc refinement through selective sampling.
8+
In 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE) (pp. 782-792). IEEE.
9+
10+
These tasks represent the 53 benchmarks
11+
that are listed in table 1 in this publication.
12+
13+
The original repository for zilu was at (according to the paper):
14+
https://github.com/lijiaying/zilu
15+
16+
It seems this repository was deleted or set to private.
17+
The original repository was published unter GPL-2.0,
18+
a copy I made can be found at:
19+
https://github.com/MartinSpiessl/zilu
20+
21+
So I supply these tasks unter GPL-2.0 as well.
22+
23+
The paper mentions that the tasks were collected
24+
from various papers/sources, one of them being SV-COMP.
25+
It is not easy to identify which tasks were taken from which source,
26+
and the authors state many of the SV-COMP tasks had to be excluded anyway
27+
because they were too complicated/ out of scope.
28+
Also the tasks are written down in a simplified format
29+
in the zilu repository in special files with the extension "cfg".
30+
31+
I did the translation into SV-COMP compliant tasks
32+
myself with a small python script.
33+
Due to these 2 transformations,
34+
I do not believe that the tasks contain
35+
any copyrightable material anymore
36+
from the publications they were originally taken from.
37+
Also the tasks are very simple,
38+
so they will probably fall below the
39+
threshold of originality anyway.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <assert.h>
2+
void reach_error(void) {assert(0);}
3+
4+
extern int __VERIFIER_nondet_int(void);
5+
extern _Bool __VERIFIER_nondet_bool(void);
6+
7+
void __VERIFIER_assert(int cond) {
8+
if (!cond) {
9+
reach_error();
10+
}
11+
}
12+
13+
/* 01.cfg:
14+
names=x y
15+
beforeloop=
16+
beforeloopinit=
17+
precondition=x==1 && y==1
18+
loopcondition=
19+
loop=x=x+y; y=x;
20+
postcondition=y>=1
21+
afterloop=
22+
learners= conj
23+
*/
24+
int main() {
25+
int x = __VERIFIER_nondet_int();
26+
int y = __VERIFIER_nondet_int();
27+
28+
if (!(x==1 && y==1)) return 0;
29+
while (__VERIFIER_nondet_bool()) {
30+
x=x+y;
31+
y=x;
32+
}
33+
__VERIFIER_assert(y>=1);
34+
return 0;
35+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
extern void __assert_fail (const char *__assertion, const char *__file,
3+
unsigned int __line, const char *__function)
4+
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
5+
extern void __assert_perror_fail (int __errnum, const char *__file,
6+
unsigned int __line, const char *__function)
7+
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
8+
extern void __assert (const char *__assertion, const char *__file, int __line)
9+
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
10+
11+
void reach_error(void) {((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "benchmark01_conjunctive.c", 2, __extension__ __PRETTY_FUNCTION__); }));}
12+
extern int __VERIFIER_nondet_int(void);
13+
extern _Bool __VERIFIER_nondet_bool(void);
14+
void __VERIFIER_assert(int cond) {
15+
if (!cond) {
16+
reach_error();
17+
}
18+
}
19+
int main() {
20+
int x = __VERIFIER_nondet_int();
21+
int y = __VERIFIER_nondet_int();
22+
if (!(x==1 && y==1)) return 0;
23+
while (__VERIFIER_nondet_bool()) {
24+
x=x+y;
25+
y=x;
26+
}
27+
__VERIFIER_assert(y>=1);
28+
return 0;
29+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
format_version: '2.0'
2+
3+
input_files: 'benchmark01_conjunctive.i'
4+
5+
properties:
6+
- property_file: ../properties/no-overflow.prp
7+
expected_verdict: false
8+
9+
options:
10+
language: C
11+
data_model: ILP32

c/loop-zilu/benchmark02_linear.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <assert.h>
2+
void reach_error(void) {assert(0);}
3+
4+
extern int __VERIFIER_nondet_int(void);
5+
extern _Bool __VERIFIER_nondet_bool(void);
6+
7+
void __VERIFIER_assert(int cond) {
8+
if (!cond) {
9+
reach_error();
10+
}
11+
}
12+
13+
/* 02.cfg:
14+
names=l
15+
beforeloop= int n; int i;
16+
beforeloopinit= i = l;
17+
precondition= l>0
18+
loopcondition= i < n
19+
loop=i++;
20+
postcondition=l>=1
21+
afterloop=
22+
learners= linear
23+
*/
24+
int main() {
25+
int n = __VERIFIER_nondet_int();
26+
int i = __VERIFIER_nondet_int();
27+
int l = __VERIFIER_nondet_int();
28+
i = l;
29+
if (!(l>0)) return 0;
30+
while (i < n) {
31+
i++;
32+
}
33+
__VERIFIER_assert(l>=1);
34+
return 0;
35+
}

0 commit comments

Comments
 (0)