Skip to content

Commit 2c36f47

Browse files
author
Owen
committed
Test symex can resolve class identifier
Test that symex knows the class identifier of nondet-initialised inputs to the entrypoint function.
1 parent 2fef1eb commit 2c36f47

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public class Test {
2+
3+
public static class A {
4+
public int getInteger() {
5+
return 0;
6+
}
7+
}
8+
9+
public static class B extends A {
10+
public int getInteger() {
11+
return 1;
12+
}
13+
}
14+
15+
public static void test(A a) {
16+
// Need to instantiate B to make sure it's loaded
17+
B dummyB = new B();
18+
19+
int zero = a.getInteger();
20+
assert(zero == 2);
21+
}
22+
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
Test.class
3+
--function Test.test --show-vcc
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
java::Test\$B\.getInteger
8+
^warning: ignoring
9+
--
10+
Symex should have the values of all class_identifier fields in its constant
11+
propagation map, so that it can run efficiently and create a simpler equation.
12+
If an argument to the entrypoint is nondet-initialised using automatic local
13+
initialisation then symex thinks its class identifier might be uninitialised,
14+
and hence could be anything, because that's what happens in the null case (but
15+
we never access the class identifier in this case). Hence we have switched to
16+
dynamic allocation for this situation.

0 commit comments

Comments
 (0)