File tree 15 files changed +329
-0
lines changed
regression/goto-instrument
15 files changed +329
-0
lines changed Original file line number Diff line number Diff line change
1
+ // test should pass. Shortest path main -> C -> D
2
+ void D ()
3
+ {
4
+ __CPROVER_assert (0 , "" );
5
+ }
6
+
7
+ void C ()
8
+ {
9
+ int nondet ;
10
+ if (nondet )
11
+ D ();
12
+ }
13
+
14
+ void B ()
15
+ {
16
+ C ();
17
+ };
18
+
19
+ int main ()
20
+ {
21
+ int nondet ;
22
+
23
+ __CPROVER_assume (nondet != 3 );
24
+ switch (nondet )
25
+ {
26
+ case 1 :
27
+ B ();
28
+ break ;
29
+ case 3 :
30
+ C ();
31
+ break ;
32
+ default :
33
+ break ;
34
+ }
35
+ return 0 ;
36
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ // test should pass. Shortest path is preserved, main -> C -> D,
2
+ // but is not a possible counterexample because of assumption that
3
+ // nondet != 3
4
+
5
+ void D ()
6
+ {
7
+ __CPROVER_assert (0 , "" );
8
+ }
9
+
10
+ void C ()
11
+ {
12
+ int nondet ;
13
+ if (nondet )
14
+ D ();
15
+ }
16
+
17
+ void B ()
18
+ {
19
+ C ();
20
+ };
21
+
22
+ int main ()
23
+ {
24
+ int nondet ;
25
+
26
+ __CPROVER_assume (nondet != 3 );
27
+ switch (nondet )
28
+ {
29
+ case 1 :
30
+ B ();
31
+ break ;
32
+ case 3 :
33
+ C ();
34
+ break ;
35
+ default :
36
+ break ;
37
+ }
38
+ return 0 ;
39
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice --property D.assertion.1
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ // test should fail. Shortest path is preserved, main -> C -> D,
2
+ void D ()
3
+ {
4
+ __CPROVER_assert (0 , "" );
5
+ }
6
+
7
+ void C ()
8
+ {
9
+ int nondet ;
10
+ if (nondet )
11
+ D ();
12
+ }
13
+
14
+ void B ()
15
+ {
16
+ C ();
17
+ };
18
+
19
+ int main ()
20
+ {
21
+ int nondet ;
22
+
23
+ switch (nondet )
24
+ {
25
+ case 1 :
26
+ B ();
27
+ break ;
28
+ case 3 :
29
+ C ();
30
+ break ;
31
+ default :
32
+ break ;
33
+ }
34
+ return 0 ;
35
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ // test should fail
2
+ // shortest path only is not sufficient to violate assertion,
3
+ // but we specifically require that function B is kept, which
4
+ // allows path main -> B -> C -> D
5
+
6
+ void D ()
7
+ {
8
+ __CPROVER_assert (0 , "" );
9
+ }
10
+
11
+ void C ()
12
+ {
13
+ int nondet ;
14
+ if (nondet )
15
+ D ();
16
+ }
17
+
18
+ void B ()
19
+ {
20
+ C ();
21
+ };
22
+
23
+ int main ()
24
+ {
25
+ int nondet ;
26
+ __CPROVER_assume (nondet != 3 );
27
+ switch (nondet )
28
+ {
29
+ case 1 :
30
+ B ();
31
+ break ;
32
+ case 3 :
33
+ C ();
34
+ break ;
35
+ default :
36
+ break ;
37
+ }
38
+ return 0 ;
39
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice --aggressive-slice-preserve-function B
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ // Test should fail. Shortest path only is not sufficient
2
+ // due to assumption that nondet !=3, but
3
+ // preserve-all-direct-paths preserves the path main -> B -> C -> D.
4
+
5
+ void D ()
6
+ {
7
+ __CPROVER_assert (0 , "" );
8
+ }
9
+
10
+ void C ()
11
+ {
12
+ int nondet ;
13
+ if (nondet )
14
+ D ();
15
+ }
16
+
17
+ void B ()
18
+ {
19
+ C ();
20
+ };
21
+
22
+ int main ()
23
+ {
24
+ int nondet ;
25
+ __CPROVER_assume (nondet != 3 );
26
+ switch (nondet )
27
+ {
28
+ case 1 :
29
+ B ();
30
+ break ;
31
+ case 3 :
32
+ C ();
33
+ break ;
34
+ default :
35
+ break ;
36
+ }
37
+ return 0 ;
38
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice --property D.assertion.1 --aggressive-slice-preserve-all-direct-paths
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ // Test should fail
2
+ // Assertion in D is reachable when call depth of 1 is preserved,
3
+ // Shortest path = main -> C -> D, which is not possible due to assumption
4
+ // nondet!=3, but call depth 1 preserves the body of function B, which can also reach
5
+ // C.
6
+
7
+ void D ()
8
+ {
9
+ __CPROVER_assert (0 , "" );
10
+ }
11
+
12
+ void C ()
13
+ {
14
+ int nondet ;
15
+ if (nondet )
16
+ D ();
17
+ }
18
+
19
+ void B ()
20
+ {
21
+ C ();
22
+ };
23
+
24
+ int main ()
25
+ {
26
+ int nondet ;
27
+ __CPROVER_assume (nondet != 3 );
28
+ switch (nondet )
29
+ {
30
+ case 1 :
31
+ B ();
32
+ break ;
33
+ case 3 :
34
+ C ();
35
+ break ;
36
+ default :
37
+ break ;
38
+ }
39
+ return 0 ;
40
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice --aggressive-slice-call-depth 1
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ // Test should fail
2
+ // Assertion in D is reachable by main -> C -> D
3
+ // Assertion in E is reachable by main -> E
4
+
5
+ void D ()
6
+ {
7
+ __CPROVER_assert (0 , "" );
8
+ }
9
+
10
+ void C ()
11
+ {
12
+ int nondet ;
13
+ if (nondet )
14
+ D ();
15
+ }
16
+
17
+ void B ()
18
+ {
19
+ C ();
20
+ };
21
+
22
+ void E ()
23
+ {
24
+ __CPROVER_assert (0 , "" );
25
+ }
26
+
27
+ int main ()
28
+ {
29
+ int nondet ;
30
+
31
+ switch (nondet )
32
+ {
33
+ case 1 :
34
+ B ();
35
+ break ;
36
+ case 2 :
37
+ E ();
38
+ break ;
39
+ case 3 :
40
+ C ();
41
+ break ;
42
+ default :
43
+ break ;
44
+ }
45
+ return 0 ;
46
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --aggressive-slice
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ --
8
+ ^warning: ignoring
You can’t perform that action at this time.
0 commit comments