File tree 6 files changed +106
-0
lines changed
regression/cbmc/declaration-goto
6 files changed +106
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ extern void __VERIFIER_assume (int cond );
4
+ extern int __VERIFIER_nondet_int (void );
5
+
6
+ int main (void )
7
+ {
8
+ if (__VERIFIER_nondet_int ())
9
+ goto switch_2_1 ;
10
+ int tmp_ndt_4 = __VERIFIER_nondet_int ();
11
+ __VERIFIER_assume (__VERIFIER_nondet_int ());
12
+ __VERIFIER_assume (tmp_ndt_4 == 1 );
13
+ switch_2_1 :
14
+ assert (tmp_ndt_4 > 0 );
15
+ return 0 ;
16
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ issue7997.c
3
+ --trace
4
+ \[main\.assertion\.1\] line \d+ assertion tmp_ndt_4 \> 0\: FAILURE
5
+ return_value___VERIFIER_nondet_int=[1-9]\d*
6
+ ^EXIT=10$
7
+ ^SIGNAL=0$
8
+ ^VERIFICATION FAILED$
9
+ --
10
+ --
11
+ The assertion should be falsifiable when `goto switch_2_1` introduces
12
+ `tmp_ndt_4` to the scope without initialising it.
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ extern void __VERIFIER_assume (int cond );
4
+
5
+ int main (void )
6
+ {
7
+ int l = 2 ;
8
+ int if_condition1 ;
9
+ if (if_condition1 )
10
+ {
11
+ unsigned int j = 42 ;
12
+ l = 3 ;
13
+ goto merge_point ;
14
+ }
15
+ int if_condition2 ;
16
+ if (if_condition2 )
17
+ {
18
+ l = 4 ;
19
+ unsigned int k = 24 ;
20
+ goto merge_point ;
21
+ }
22
+ int i = 3 ;
23
+ int m = 9 ;
24
+
25
+ merge_point :
26
+ assert (i == 3 || m == 9 || l == 3 );
27
+ assert (i == 3 || m == 9 || l == 4 );
28
+ return 0 ;
29
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ multiple_goto_single_label.c
3
+
4
+ \[main\.assertion\.1\] line \d+ assertion i \=\= 3 \|\| m \=\= 9 \|\| l \=\= 3\: FAILURE
5
+ \[main\.assertion\.2\] line \d+ assertion i \=\= 3 \|\| m \=\= 9 \|\| l \=\= 4\: FAILURE
6
+ ^EXIT=10$
7
+ ^SIGNAL=0$
8
+ ^VERIFICATION FAILED$
9
+ --
10
+ --
11
+ Test for the case where there are multiple gotos which target the same label
12
+ and both introduce variables into the scope.
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ extern void __VERIFIER_assume (int cond );
4
+
5
+ int main (void )
6
+ {
7
+ int if_condition ;
8
+ if (if_condition )
9
+ {
10
+ unsigned int i = 42 ;
11
+ goto j_scope ;
12
+ i_scope :
13
+ assert (i == 42 );
14
+ return 0 ;
15
+ }
16
+ int j = 3 ;
17
+ assert (j == 3 );
18
+
19
+ j_scope :
20
+ assert (j == 3 );
21
+ if (if_condition )
22
+ goto i_scope ;
23
+ return 0 ;
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ re-enter_scope.c
3
+
4
+ \[main\.assertion\.1\] line 13 assertion i \=\= 42\: FAILURE
5
+ \[main\.assertion\.2\] line 17 assertion j \=\= 3\: SUCCESS
6
+ \[main\.assertion\.3\] line 20 assertion j \=\= 3\: FAILURE
7
+ ^EXIT=10$
8
+ ^SIGNAL=0$
9
+ ^VERIFICATION FAILED$
10
+ --
11
+ --
12
+ Test that if execution re-enters a scope via a goto the pre-existing variable
13
+ becomes non-det.
You can’t perform that action at this time.
0 commit comments