Skip to content

Commit 6c90b35

Browse files
author
Daniel Kroening
authored
Merge pull request #2052 from romainbrenguier/bugfix/default-axioms2#TG-2138
[TG-2138] Stop adding default axioms in string solver
2 parents 53dfa0a + b59a453 commit 6c90b35

File tree

26 files changed

+232
-105
lines changed

26 files changed

+232
-105
lines changed
0 Bytes
Binary file not shown.

regression/jbmc-strings/long_string/Test.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public static void checkAbort(String s, String t) {
3030
String u = s.concat(t);
3131

3232
// Filter out
33-
if(u.length() < 67_108_864)
33+
// 67_108_864 corresponds to the maximum length for which the solver
34+
// will concretize the string.
35+
if(u.length() <= 67_108_864)
3436
return;
3537
if(CProverString.charAt(u, 2_000_000) != 'b')
3638
return;
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
CORE
22
Test.class
3-
--refine-strings --function Test.checkAbort
4-
^EXIT=6$
3+
--refine-strings --function Test.checkAbort --trace
4+
^EXIT=10$
55
^SIGNAL=0$
6+
dynamic_object[0-9]*=\(assignment removed\)
67
--
78
--
8-
This tests should abort, because concretizing a string of the required
9-
length may take to much memory.
9+
This tests that the object does not appear in the trace, because concretizing
10+
a string of the required length may take too much memory.
Binary file not shown.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
public class IntegerTests {
2+
3+
public static Boolean testMyGenSet(Integer key) {
4+
if (key == null) return null;
5+
MyGenSet<Integer> ms = new MyGenSet<>();
6+
ms.array[0] = 101;
7+
if (ms.contains(key)) return true;
8+
return false;
9+
}
10+
11+
public static Boolean testMySet(Integer key) {
12+
if (key == null) return null;
13+
MySet ms = new MySet();
14+
ms.array[0] = 101;
15+
if (ms.contains(key)) return true;
16+
return false;
17+
}
18+
19+
}
20+
21+
class MyGenSet<E> {
22+
E[] array;
23+
@SuppressWarnings("unchecked")
24+
MyGenSet() {
25+
array = (E[]) new Object[1];
26+
}
27+
boolean contains(E o) {
28+
if (o.equals(array[0]))
29+
return true;
30+
return false;
31+
}
32+
}
33+
34+
class MySet {
35+
Integer[] array;
36+
MySet() {
37+
array = new Integer[1];
38+
}
39+
boolean contains(Integer o) {
40+
if (o.equals(array[0]))
41+
return true;
42+
return false;
43+
}
44+
}
Binary file not shown.
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CORE
2+
IntegerTests.class
3+
-refine-strings --string-max-length 100 IntegerTests.class --function IntegerTests.testMySet --cover location
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
coverage.* line 12 function java::IntegerTests.testMySet.* bytecode-index 1 .* SATISFIED
7+
coverage.* line 12 function java::IntegerTests.testMySet.* bytecode-index 3 .* SATISFIED
8+
coverage.* line 13 function java::IntegerTests.testMySet.* bytecode-index 4 .* SATISFIED
9+
coverage.* line 13 function java::IntegerTests.testMySet.* bytecode-index 6 .* SATISFIED
10+
coverage.* line 13 function java::IntegerTests.testMySet.* bytecode-index 7 .* SATISFIED
11+
coverage.* line 14 function java::IntegerTests.testMySet.* bytecode-index 12 .* SATISFIED
12+
coverage.* line 14 function java::IntegerTests.testMySet.* bytecode-index 13 .* SATISFIED
13+
coverage.* line 15 function java::IntegerTests.testMySet.* bytecode-index 16 .* SATISFIED
14+
coverage.* line 15 function java::IntegerTests.testMySet.* bytecode-index 17 .* SATISFIED
15+
coverage.* line 16 function java::IntegerTests.testMySet.* bytecode-index 21 .* SATISFIED
16+
coverage.* line 15 function java::IntegerTests.testMySet.* bytecode-index 19 .* SATISFIED
17+
coverage.* line 15 function java::IntegerTests.testMySet.* bytecode-index 20 .* SATISFIED
18+
coverage.* line 16 function java::IntegerTests.testMySet.* bytecode-index 22 .* SATISFIED
19+
coverage.* line 16 function java::IntegerTests.testMySet.* bytecode-index 23 .* SATISFIED
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CORE
2+
IntegerTests.class
3+
-refine-strings --string-max-length 100 IntegerTests.class --function IntegerTests.testMyGenSet --cover location
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
coverage.* line 4 function java::IntegerTests.testMyGenSet.* bytecode-index 1 .* SATISFIED
7+
coverage.* line 4 function java::IntegerTests.testMyGenSet.* bytecode-index 3 .* SATISFIED
8+
coverage.* line 5 function java::IntegerTests.testMyGenSet.* bytecode-index 4 .* SATISFIED
9+
coverage.* line 5 function java::IntegerTests.testMyGenSet.* bytecode-index 6 .* SATISFIED
10+
coverage.* line 5 function java::IntegerTests.testMyGenSet.* bytecode-index 7 .* SATISFIED
11+
coverage.* line 6 function java::IntegerTests.testMyGenSet.* bytecode-index 10 .* SATISFIED
12+
coverage.* line 6 function java::IntegerTests.testMyGenSet.* bytecode-index 13 .* SATISFIED
13+
coverage.* line 6 function java::IntegerTests.testMyGenSet.* bytecode-index 14 .* SATISFIED
14+
coverage.* line 7 function java::IntegerTests.testMyGenSet.* bytecode-index 17 .* SATISFIED
15+
coverage.* line 7 function java::IntegerTests.testMyGenSet.* bytecode-index 18 .* SATISFIED
16+
coverage.* line 8 function java::IntegerTests.testMyGenSet.* bytecode-index 22 .* SATISFIED
17+
coverage.* line 7 function java::IntegerTests.testMyGenSet.* bytecode-index 20 .* SATISFIED
18+
coverage.* line 7 function java::IntegerTests.testMyGenSet.* bytecode-index 21 .* SATISFIED
19+
coverage.* line 8 function java::IntegerTests.testMyGenSet.* bytecode-index 23 .* SATISFIED
20+
coverage.* line 8 function java::IntegerTests.testMyGenSet.* bytecode-index 24 .* SATISFIED
1.04 KB
Binary file not shown.

0 commit comments

Comments
 (0)