Skip to content

Commit 557158e

Browse files
authored
Merge pull request diffblue#334 from diffblue/pull-support-20180216
Merge from master, 20180216
2 parents ad7b28e + 1e48132 commit 557158e

File tree

588 files changed

+9647
-3637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

588 files changed

+9647
-3637
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ src/goto-analyzer/taint_driver_scripts/.idea/*
1010
/*.creator
1111
/*.creator.user
1212
/*.files
13+
/*.idea
1314
/*.includes
1415
# Eclipse
1516
src/.cproject
@@ -45,6 +46,7 @@ src/ansi-c/gcc_builtin_headers_tm.inc
4546
src/ansi-c/gcc_builtin_headers_mips.inc
4647
src/ansi-c/gcc_builtin_headers_power.inc
4748
src/ansi-c/gcc_builtin_headers_ubsan.inc
49+
src/java_bytecode/java_core_models.inc
4850

4951
# regression/test files
5052
*.out
@@ -116,8 +118,11 @@ src/ansi-c/file_converter
116118
src/ansi-c/file_converter.exe
117119
src/ansi-c/library/converter
118120
src/ansi-c/library/converter.exe
121+
src/java_bytecode/converter
122+
src/java_bytecode/converter.exe
119123
src/util/irep_ids_convert
120124
src/util/irep_ids_convert.exe
125+
build/
121126

122127
*.pyc
123128

regression/cbmc-java/ArithmeticException6/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
ArithmeticExceptionTest.class
3-
--java-throw-runtime-exceptions
3+
--java-throw-runtime-exceptions --function ArithmeticExceptionTest.main
44
^EXIT=10$
55
^SIGNAL=0$
66
^.*assertion at file ArithmeticExceptionTest.java line 7 function.*: FAILURE$

regression/cbmc-java/LocalVarTable5/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
test.class
3-
--show-goto-functions
3+
--show-goto-functions --function test.main
44
dead anonlocal::1i
55
dead anonlocal::2i
66
dead anonlocal::3a
452 Bytes
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import org.cprover.CProver;
2+
3+
class Test {
4+
5+
int[] arr;
6+
7+
void cproverNondetInitialize() {
8+
CProver.assume(arr != null && arr.length == 1);
9+
// The following access should now be legal:
10+
arr[0] = 100;
11+
}
12+
13+
public static void main(Test nondetInput) {
14+
}
15+
16+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CORE
2+
Test.class
3+
--function Test.main
4+
^VERIFICATION SUCCESSFUL$
174 Bytes
Binary file not shown.
737 Bytes
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import org.cprover.CProver;
2+
3+
class Test {
4+
5+
int[] arr;
6+
7+
void cproverNondetInitialize() {
8+
CProver.assume(arr != null && arr.length == 1);
9+
// The following access should now be legal:
10+
arr[0] = 100;
11+
}
12+
13+
public static void main(Subclass nondetInput) {
14+
// The condition enforced by cproverNondetInitialize should hold
15+
// even though the parameter is a subtype of Test, not directly an
16+
// instance of Test itself.
17+
if(nondetInput != null)
18+
assert nondetInput.arr.length == 1;
19+
}
20+
21+
}
22+
23+
class Subclass extends Test { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CORE
2+
Test.class
3+
--function Test.main
4+
^VERIFICATION SUCCESSFUL$

regression/cbmc-java/VarLengthArrayTrace1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
VarLengthArrayTrace1.class
3-
--trace
3+
--trace --function VarLengthArrayTrace1.main
44
^EXIT=10$
55
^SIGNAL=0$
66
dynamic_3_array\[1.*\]=10

regression/cbmc-java/arrayread1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
arrayread1.class
3-
--unwind 3 --no-propagation
3+
--unwind 3 --no-propagation --function arrayread1.main
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc-java/cast_null1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
test.class
3-
3+
--function test.main
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc-java/cast_null2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
test.class
3-
--java-throw-runtime-exceptions
3+
--java-throw-runtime-exceptions --function test.main
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
582 Bytes
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
--show-symbol-table
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^Symbol\s*\.*\: java\:\:org\.cprover\.CProver\.\<clinit\>\:\(\)V$
7+
--
8+
--
9+
tests that the core models are being loaded by checking if the static initializer for the CProver class was
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import org.cprover.CProver;
2+
class test
3+
{
4+
public static void main(String[] args)
5+
{
6+
int i=CProver.nondetInt();
7+
assert(i!=0);
8+
}
9+
}
10+

regression/cbmc-java/destructor1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
Break.class
3-
--show-goto-functions
3+
--show-goto-functions --function Break.main
44
^EXIT=0$
55
^SIGNAL=0$
66
dead i;

regression/cbmc-java/exceptions22/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
test.class
3-
3+
--function test.main
44
^EXIT=0$
55
^SIGNAL=0$
66
VERIFICATION SUCCESSFUL
189 Bytes
Binary file not shown.
164 Bytes
Binary file not shown.
780 Bytes
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
test.class
3+
^VERIFICATION SUCCESSFUL$
4+
--
5+
^warning: ignoring
6+
--
7+
This test verifies that catches are executed in the correct order
8+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
class A extends RuntimeException {}
2+
class B extends A {}
3+
4+
// This test verifies that catches are executed in the correct order
5+
public class test {
6+
public static void main (String args[]) {
7+
int i = 0;
8+
try {
9+
try {
10+
throw new A();
11+
}
12+
catch(A exc) {
13+
i++;
14+
throw new B();
15+
}
16+
finally
17+
{
18+
// Make sure A threw into the catch
19+
assert(i==1);
20+
i++;
21+
}
22+
}
23+
catch(B exc) {
24+
// Make sure finally was executed
25+
assert(i==2);
26+
i++;
27+
}
28+
// Make sure B was rethrown by finally
29+
assert(i==3);
30+
}
31+
}
189 Bytes
Binary file not shown.
164 Bytes
Binary file not shown.
1.04 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
test.class
3+
VERIFICATION SUCCESSFUL
4+
--
5+
^warning: ignoring
6+
--
7+
Tests embedded try-catch-finally to ensure the catching order is correct
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import org.cprover.CProver;
2+
class A extends RuntimeException {}
3+
class B extends A {}
4+
5+
// This test verifies that catches are executed in the correct order
6+
public class test {
7+
public static void main (String args[]) {
8+
int i = 0;
9+
int j = 0;
10+
try {
11+
try {
12+
try {
13+
if (CProver.nondetBoolean()) throw new A();
14+
else throw new B();
15+
}
16+
catch(B exc) {
17+
i++;
18+
}
19+
catch(A exc) {
20+
i++;
21+
throw new B();
22+
}
23+
finally
24+
{
25+
// Make sure A threw into the catch
26+
assert(i==1);
27+
i++;
28+
}
29+
assert(i==2);
30+
// Account for the rethrow in finally
31+
j++;
32+
}
33+
catch(B exc) {
34+
// Make sure finally was executed
35+
assert(i==2);
36+
i++;
37+
throw new B();
38+
}
39+
finally
40+
{
41+
assert ((i+j) == 3);
42+
}
43+
// Account for the rethrow in finally
44+
j++;
45+
}
46+
catch(B exc)
47+
{
48+
i++;
49+
}
50+
// Make sure B was rethrown by finally when A was thrown
51+
// or if B was thrown there was no rethrow
52+
assert(i+j == 4);
53+
}
54+
}

regression/cbmc-java/external_getstatic1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
test.class
3-
3+
--function test.main
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc-java/generic_class_bound1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Gn.class
77
.*file Gn.java line 9 function java::Gn.foo1:\(LGn;\)V bytecode-index 1 block 1: FAILED
88
.*file Gn.java line 10 function java::Gn.foo1:\(LGn;\)V bytecode-index 4 block 2: FAILED
99
.*file Gn.java line 11 function java::Gn.foo1:\(LGn;\)V bytecode-index 5 block 3: FAILED
10-
.*file Gn.java line 13 function java::Gn.main:\(\[Ljava/lang/String;\)V bytecode-index 2 block 1: SATISFIED
10+
.*file Gn.java line 13 function java::Gn.main:\(\[Ljava/lang/String;\)V bytecode-index 2 block 2: SATISFIED
1111
--

regression/cbmc-java/inferlexicalscope1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
test.class
3-
--show-symbol-table
3+
--show-symbol-table --function test.main
44
^EXIT=0$
55
^SIGNAL=0$
66
^pc7:
Binary file not shown.
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class Test extends Parent {
2+
3+
public static void main(int nondet) {
4+
5+
x = nondet;
6+
assert x == Parent.x;
7+
8+
}
9+
10+
}
11+
12+
class Parent {
13+
14+
public static int x;
15+
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Test.class
3+
--function Test.main
4+
^VERIFICATION SUCCESSFUL$
5+
--
6+
--
7+
This checks that jbmc knows that test.x and parent.x refer to the same field.
8+
Both test and parent are concrete (available) classes.
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
public class Parent {
3+
4+
// This is the version of Parent we will run jbmc against, which has
5+
// a static field 'x', but that field is private and cannot correspond
6+
// to the reference 'Test.x'.
7+
private static int x;
8+
9+
}
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class Test extends Parent {
2+
3+
public static void main(int nondet) {
4+
5+
x = nondet;
6+
assert x == Parent.x;
7+
8+
}
9+
10+
}
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
public class Parent {
3+
4+
// This is the version of Parent we compile Test.java against, which does
5+
// have a static field 'x'.
6+
public static int x;
7+
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
Test.class
3+
--function Test.main
4+
Stub static field x found for non-stub type java::Test\. In future this will be a fatal error\.
5+
assertion at file Test\.java line 6 .* FAILURE
6+
^VERIFICATION FAILED$
7+
--
8+
Stub static field x found for non-stub type java::Parent\. In future this will be a fatal error\.
9+
--
10+
This test is the same as inherited_static_field9, except that the version of Parent we run against
11+
has a private static field that Test's 'x' cannot be referring to.
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import java.util.ArrayList;
2+
3+
interface InterfaceWithStatic {
4+
5+
// The ArrayList is only here to define a constant x that
6+
// is complicated enough for javac to generate a static init
7+
// rather than just propagate the constant to all users.
8+
static ArrayList<Integer> al = new ArrayList<Integer>();
9+
static int x = al.size();
10+
11+
}
12+
Binary file not shown.
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class Test extends Parent implements InterfaceWithStatic {
2+
3+
public static void main() {
4+
5+
int val1 = InterfaceWithStatic.x;
6+
int val2 = x;
7+
assert val1 == val2;
8+
9+
}
10+
11+
}
12+
13+
class Parent {
14+
15+
}
16+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Test.class
3+
--function Test.main
4+
^VERIFICATION SUCCESSFUL$
5+
--
6+
--
7+
This checks that jbmc knows that Test.x and InterfaceWithStatic.x are the same field.
8+
All types are concrete (not stubs).
Binary file not shown.

0 commit comments

Comments
 (0)