File tree 3 files changed +36
-0
lines changed
jbmc/regression/jbmc/nondet-static 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ public class My {
2
+ public static int s_non_init ;
3
+ public static int s_init = 1 ;
4
+ public static int s_static_init ;
5
+ static { s_static_init = 2 ; }
6
+
7
+ public int field ;
8
+
9
+ public My (int i ) {
10
+ String s = "bla" ;
11
+ field = i ;
12
+
13
+ /* Pass normally but fail with nondet-static */
14
+ assert (s_non_init == 0 );
15
+ assert (s_init == 1 );
16
+ assert (s_static_init == 2 );
17
+
18
+ /* Should still pass */
19
+ assert (s == "bla" );
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ My.class
3
+ --function "My.<init>" --nondet-static
4
+ ^VERIFICATION FAILED$
5
+ ^EXIT=10$
6
+ ^SIGNAL=0$
7
+ assertion at file My\.java line 14 function java::My\.\<init\>:\(I\)V.*FAILURE$
8
+ assertion at file My\.java line 15 function java::My\.\<init\>:\(I\)V.*FAILURE$
9
+ assertion at file My\.java line 16 function java::My\.\<init\>:\(I\)V.*FAILURE$
10
+ assertion at file My\.java line 19 function java::My\.\<init\>:\(I\)V.*SUCCESS$
11
+ --
12
+ --
13
+ This tests nondet-static option, namely that static (non-final) variables are
14
+ non-det initialized regardless of whether they are given a (static) initializer
15
+ or not but constants such as strings are not non-det initialized
You can’t perform that action at this time.
0 commit comments