File tree 8 files changed +104
-0
lines changed
jbmc/regression/jbmc/array-cell-sensitivity-static-fields 8 files changed +104
-0
lines changed Original file line number Diff line number Diff line change
1
+ class Util {
2
+ public static char [] chars (int count ) {
3
+ char result [] = new char [count ];
4
+ for (int i = 0 ; i < count ; ++i ) {
5
+ result [i ] = (char )((int )'a' + i );
6
+ }
7
+ return result ;
8
+ }
9
+ }
10
+
11
+ public class Test {
12
+ // static field which is initialized to a non-empty value
13
+ public static char [] staticCharArray = Util .chars (26 );
14
+ // reference to the same array
15
+ public static char [] staticCharArrayRef = staticCharArray ;
16
+
17
+ public static char [] charArray () {
18
+ staticCharArray [0 ] = staticCharArray [3 ];
19
+ staticCharArray [1 ] = 'e' ;
20
+ assert staticCharArray [0 ] == 'd' ;
21
+ assert staticCharArray [0 ] == 'A' ;
22
+ return staticCharArray ;
23
+ }
24
+
25
+ public static char [] charArrayRef () {
26
+ staticCharArrayRef [0 ] = staticCharArray [3 ];
27
+ staticCharArray [1 ] = 'e' ;
28
+ if (staticCharArray [0 ] == 'A' ) {
29
+ assert false ;
30
+ } else if (staticCharArray [0 ] == 'd' ) {
31
+ assert false ;
32
+ }
33
+
34
+ return staticCharArray ;
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "@type" :" com.diffblue.retriever.StaticFieldMap" ,
3
+ "Test" :{
4
+ "@type" :" com.diffblue.retriever.StaticFieldMap" ,
5
+ "staticCharArrayRef" :{
6
+ "@type" :" [C" ,
7
+ "@ref" : " id1"
8
+ },
9
+ "staticCharArray" :{
10
+ "@type" :" [C" ,
11
+ "@id" : " id1" ,
12
+ "@items" :[
13
+ " abcAefghijklmnopqrstuvwxyz"
14
+ ]
15
+ }
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Test.class
3
+ --function Test.charArrayRef --property "java::Test.charArrayRef:()[C.assertion.2" --static-values static-values.json
4
+ Generated 0 VCC[(]s[)], 0 remaining after simplification
5
+ assertion at file Test.java line 31 .*: SUCCESS
6
+ ^EXIT=0$
7
+ ^SIGNAL=0$
8
+ --
9
+ --
10
+ Not that the json file has been modified on purpose so that this checks
11
+ that it is actually loaded and not retrieved by execution of the Util function.
12
+ This test does not work with symex-driven-lazy-loading because this option is
13
+ not compatible with --property.
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Test.class
3
+ --function Test.charArrayRef --property "java::Test.charArrayRef:()[C.assertion.1"
4
+ Generated 0 VCC[(]s[)], 0 remaining after simplification
5
+ assertion at file Test.java line 29 .*: SUCCESS
6
+ ^EXIT=0$
7
+ ^SIGNAL=0$
8
+ --
9
+ --
10
+ Not that the json file has been modified on purpose so that this checks
11
+ that it is actually loaded and not retrieved by execution of the Util function.
12
+ This test does not work with symex-driven-lazy-loading because this option is
13
+ not compatible with --property.
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Test.class
3
+ --function Test.charArray --property "java::Test.charArray:()[C.assertion.2" --static-values static-values.json
4
+ Generated 0 VCC[(]s[)], 0 remaining after simplification
5
+ assertion at file Test.java line 21 .*: SUCCESS
6
+ ^EXIT=0$
7
+ ^SIGNAL=0$
8
+ --
9
+ --
10
+ Not that the json file has been modified on purpose so that this checks
11
+ that it is actually loaded and not retrieved by execution of the Util function.
12
+ This test does not work with symex-driven-lazy-loading because this option is
13
+ not compatible with --property.
Original file line number Diff line number Diff line change
1
+ CORE symex-driven-lazy-loading-expected-failure
2
+ Test.class
3
+ --function Test.charArray --property "java::Test.charArray:()[C.assertion.1"
4
+ Generated 0 VCC[(]s[)], 0 remaining after simplification
5
+ assertion at file Test.java line 20 .*: SUCCESS
6
+ ^EXIT=0$
7
+ ^SIGNAL=0$
8
+ --
9
+ --
10
+ Checks that constant propagation happens through static arrays.
11
+ This test does not work with symex-driven-lazy-loading because this option is
12
+ not compatible with --property.
You can’t perform that action at this time.
0 commit comments