Skip to content

Commit 1ee0dd9

Browse files
authored
Merge pull request #1943 from forejtv/forejtv/reachability-slicer
Changes to the reachability slicer
2 parents 7e00a30 + 6120c17 commit 1ee0dd9

File tree

19 files changed

+299
-38
lines changed

19 files changed

+299
-38
lines changed
318 Bytes
Binary file not shown.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class A {
2+
3+
public void foo(int i ) {
4+
// We use integer constants that we grep for later in a goto program.
5+
int x = 1001 + i;
6+
if (i > 0) {
7+
x = 1002 + i; // property "java::A.foo:(I)V.coverage.3", see https://github.com/diffblue/cbmc/pull/1943#discussion_r175367063 for a discusison.
8+
x = 1003 + i;
9+
}
10+
else
11+
x = 1004 + i;
12+
x = 1005 + i;
13+
}
14+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
A.class
3+
--reachability-slice --show-goto-functions --property 'java::A.foo:(I)V.coverage.3' --cover location
4+
1001
5+
--
6+
1003
7+
1004
8+
1005
9+
--
10+
Note: 1002 might and might not be removed, based on where the assertion for coverage resides.
11+
At the time of writing of this test, 1002 is removed.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
A.class
3+
--reachability-slice-fb --show-goto-functions --property 'java::A.foo:(I)V.coverage.3' --cover location
4+
1001
5+
1002
6+
1003
7+
1005
8+
--
9+
1004
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
A.class
3+
--reachability-slice --show-goto-functions --cover location
4+
1001
5+
1002
6+
1003
7+
1004
8+
1005
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
void foo(int i)
2+
{
3+
// We use integer constants that we grep for later in a goto program.
4+
int x = 1001 + i;
5+
if(i > 0)
6+
{ //foo.coverage.2
7+
x = 1002 + i;
8+
x = 1003 + i;
9+
}
10+
else
11+
x = 1004 + i;
12+
x = 1005 + i;
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.c
3+
--reachability-slice --show-goto-functions --cover location --property foo.coverage.2
4+
1001
5+
--
6+
1004
7+
1005
8+
--
9+
We do not include 1002 and 1003, whether this is hit depends on where assertion is put
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.c
3+
--reachability-slice-fb --show-goto-functions --cover location --property foo.coverage.2
4+
1001
5+
1002
6+
1003
7+
1005
8+
--
9+
1004
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
--reachability-slice --show-goto-functions --cover location
4+
1001
5+
1002
6+
1003
7+
1004
8+
--
9+
--
10+
We do not include 1005 since it might or might not be present based on where the assertion is in the block.

src/cbmc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ OBJ += ../ansi-c/ansi-c$(LIBEXT) \
3131
../pointer-analysis/add_failed_symbols$(OBJEXT) \
3232
../pointer-analysis/rewrite_index$(OBJEXT) \
3333
../pointer-analysis/goto_program_dereference$(OBJEXT) \
34+
../goto-instrument/reachability_slicer$(OBJEXT) \
3435
../goto-instrument/full_slicer$(OBJEXT) \
3536
../goto-instrument/nondet_static$(OBJEXT) \
3637
../goto-instrument/cover$(OBJEXT) \

0 commit comments

Comments
 (0)