File tree Expand file tree Collapse file tree 13 files changed +177
-107
lines changed
symex_should_exclude_null_pointers
symex_should_filter_value_sets Expand file tree Collapse file tree 13 files changed +177
-107
lines changed Original file line number Diff line number Diff line change
1
+ extern void foo (int * , unsigned int );
2
+
3
+ int main ()
4
+ {
5
+ #ifdef _MSC_VER
6
+ label :
7
+ int x ;
8
+ #elif defined(__GNUC__ )
9
+ int * p ;
10
+ unsigned int u ;
11
+ label :
12
+ __attribute__((unused )) foo (p , u ) ;
13
+ #endif
14
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ --
7
+ ^warning: ignoring
8
+ ^CONVERSION ERROR$
9
+ --
10
+ GCC does not permit labelling declarations as they are not considered
11
+ statements, and would result in ambiguity in case of label attributes. We used
12
+ to run into this problem, treating the function call in this test as a KnR
13
+ function declaration.
14
+
15
+ Visual Studio, on the other hand, happily accepts labelled declarations.
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ int main(int argc, char **argv) {
6
6
7
7
const float * pc = (const float []){1e0 , 1e1 , 1e2 };
8
8
9
- start :
9
+ start :;
10
10
test newAlloc0 = {0 };
11
11
if (argv [0 ])
12
12
{
@@ -20,7 +20,7 @@ int main(int argc, char **argv) {
20
20
if (argv [2 ])
21
21
{
22
22
test newAlloc3 = {3 };
23
- nested_if :
23
+ nested_if :;
24
24
test newAlloc5 = {5 };
25
25
if (argv [3 ])
26
26
{
Original file line number Diff line number Diff line change @@ -38,15 +38,15 @@ int main(int argc, char **argv) {
38
38
int * ptr4 = maybe_null ;
39
39
goto check ;
40
40
41
- deref :
41
+ deref :;
42
42
int deref4 = * ptr4 ;
43
43
goto end_test4 ;
44
44
45
45
check :
46
46
__CPROVER_assume (ptr4 != 0 );
47
47
goto deref ;
48
48
49
- end_test4 :
49
+ end_test4 :;
50
50
51
51
// Should be judged unsafe by LSPA and safe by value-set filtering
52
52
// (guarded by confluence):
Original file line number Diff line number Diff line change @@ -61,28 +61,28 @@ int main(int argc, char **argv)
61
61
int * p7 = ptr_to_a_or_b ;
62
62
goto check7 ;
63
63
64
- divide7 :
64
+ divide7 :;
65
65
int c7 = * p7 ;
66
66
goto end_test7 ;
67
67
68
68
check7 :
69
69
__CPROVER_assume (p7 != & a );
70
70
goto divide7 ;
71
71
72
- end_test7 :
72
+ end_test7 :;
73
73
74
74
int * p8 = ptr_to_a_or_b ;
75
75
goto check8 ;
76
76
77
- divide8 :
77
+ divide8 :;
78
78
int c8 = * p8 ;
79
79
goto end_test8 ;
80
80
81
81
check8 :
82
82
__CPROVER_assume (* p8 != 2 );
83
83
goto divide8 ;
84
84
85
- end_test8 :
85
+ end_test8 :;
86
86
87
87
// Should work (value-set filtered by confluence of if and else):
88
88
int * p9 = ptr_to_a_or_b ;
Original file line number Diff line number Diff line change 1
1
int main ()
2
2
{
3
3
l2 : goto l1 ;
4
- l1 : int x = 5 ;
5
- goto l2 ;
4
+ l1 :;
5
+ int x = 5 ;
6
+ goto l2 ;
6
7
7
- return 0 ;
8
+ return 0 ;
8
9
}
Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ int main()
2
2
{
3
3
int i = 0 ;
4
4
l2 : if (i == 1 ) int y = 0 ;
5
- l1 : int x = 5 ;
6
- goto l2 ;
5
+ l1 :;
6
+ int x = 5 ;
7
+ goto l2 ;
7
8
8
- return 0 ;
9
+ return 0 ;
9
10
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ int main()
8
8
y = 10 ;
9
9
goto label ;
10
10
x = 1 ; // dead code, makes sure the above goto is not removed
11
- label :
11
+ label :;
12
12
_Bool nondet ;
13
13
if (nondet )
14
14
__CPROVER_assert (y != 10 , "violated via first loop" );
Original file line number Diff line number Diff line change @@ -24,8 +24,9 @@ int main()
24
24
x = 42 ;
25
25
label_four :
26
26
assert (foo () == 1 );
27
+ fptr_t fp ;
27
28
label_five :
28
- fptr_t fp = foo ;
29
+ fp = foo ;
29
30
assert (fp () == 1 );
30
31
label_six :
31
32
return * p ;
Original file line number Diff line number Diff line change @@ -30,15 +30,15 @@ int main(int argc, char **argv) {
30
30
int * ptr4 = & x ;
31
31
goto check ;
32
32
33
- deref :
33
+ deref :;
34
34
int deref4 = * ptr4 ;
35
35
goto end_test4 ;
36
36
37
37
check :
38
38
__CPROVER_assume (ptr4 != 0 );
39
39
goto deref ;
40
40
41
- end_test4 :
41
+ end_test4 :;
42
42
43
43
// Shouldn't work yet despite being safe (guarded by confluence):
44
44
int * ptr5 = & x ;
You can’t perform that action at this time.
0 commit comments