Skip to content

Commit a83b52c

Browse files
committed
Squashed 'cbmc/' changes from ca5aa95..67ec6f2
67ec6f2 Merge remote-tracking branch 'upstream/develop' into pull-support-20180104 fabc99e Merge pull request diffblue#1563 from NathanJPhillips/feature/lazy-loading 2d67e42 Merge pull request diffblue#1692 from NathanJPhillips/feature/numbering-at 5266ba2 Merge commit 'ac4756fc3bb0e853f04de2b69f300d65cfbfc553' into pull-support-20171212 4f4a9c7 Add at method to template_numberingt d9cc0c0 Merge pull request diffblue#1685 from peterschrammel/remove-existing-coverage-goals f13c871 Update a comment in instrument_cover_goals 6c39443 Remove existing coverage goals a2cf16d Store symbol type instead of followed type when clean casting f96efb4 Change template parameter name to not clash with existing type b0cd57b Encapsulate lazy_goto_modelt::goto_functions ef02f4d Update test to handle changed symbol creation order 441d269 Reset counter used by get_fresh_aux_symbol in unit tests f759f25 Fix new test to run remove_java_new pass cb09d8e Fix new tests to use lazy loading 166563f Do lowering of java_new as a function-level pass 3779782 Always convert the main function from bytecode into the symbol_table 7e52e22 Always allow the main function not to have a body c938b08 Encapsulate maps in language_filest 87c6b28 Don't erase symbol in java_bytecode_convert_methodt::convert e3e44c8 Do type-checking as a function pass 2ba1364 Update load_all_functions 5f06e36 Recreate initialize in final aa5440b Moved call to final to lazy_goto_modelt::finalize a659bc0 Add lazy_goto_functions_mapt 7e1ecc9 Allow post-processing functions to run on a function-by-function basis 0c05be6 Allow convert_lazy_method on functions that don't have a lazy body 05a8da2 Make goto_convert_functions not add directly to function map c078858 Introduce lazy_goto_modelt a22dd1c Merge pull request diffblue#1671 from thk123/bugfix/TG-1278/correct-access-level 5b6eb00 Merge pull request diffblue#1668 from romainbrenguier/bugfix/string-index-of#TG-1846 9062853 Tidied up the generic specalised class copying the base class visibility f934ca3 String classes should be public 7b06a00 Merge pull request diffblue#1498 from smowton/smowton/feature/call_graph_improvements f3b4c9b Test for verification of the indexOf method 9a7fa2d Correct lower bound in String indexOf 682cd1a Use a symbol generator to avoid name clashes 28a2ada Access in empty array should be unconstrained d41403f Merge pull request diffblue#1665 from romainbrenguier/bugfix/string-out-of-bound#TG-1808 ac7e649 Use CProverString function in jbmc tests 22dc353 Add CProverString class for jbmc-strings tests ef610b3 Use CProverString functions in strings-smoke-tests 5c716c1 Add a CProverString class for string-smoke-tests 6b619e0 Deactivate preprocessing of charAt and substring bcfaaa4 Merge pull request diffblue#1664 from svorenova/refactoring_tg1190 c2a8bae Refactoring in specialization of generic classes 7a98e15 Rename call graph constructors 6228ed3 Slice global inits: use improved call graph d136bbc Expose limited call graph via goto-instrument 9c29bee Improve call graph unit tests 8ed3ccb Add documentation to call graph 8f6f429 Add call graph helpers 3b06a16 Call graph: add constructors that only include reachable functions 9b65862 grapht: add get_reachable function aaa8513 Call graph -> grapht transformation 8115248 Call graph: optionally record callsites git-subtree-dir: cbmc git-subtree-split: 67ec6f2
1 parent ac4756f commit a83b52c

File tree

107 files changed

+2182
-1215
lines changed

Some content is hidden

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

107 files changed

+2182
-1215
lines changed

regression/jbmc-strings/StaticCharMethods05/test.desc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ StaticCharMethods05.class
33
--refine-strings --string-max-length 1000
44
^EXIT=10$
55
^SIGNAL=0$
6-
null-pointer-exception\.14\] Throw null: FAILURE
76
^\[.*assertion\.1\] .* line 12 .* FAILURE$
87
^\[.*assertion\.2\] .* line 22 .* FAILURE$
98
^VERIFICATION FAILED$
1.15 KB
Binary file not shown.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
public class Test {
2+
3+
public boolean check(String input_String, char input_char, int input_int) {
4+
// Verify indexOf is conform to its specification
5+
int i = input_String.indexOf(input_char, input_int);
6+
7+
assert i < input_String.length();
8+
9+
int lower_bound;
10+
if (input_int < 0)
11+
lower_bound = 0;
12+
else
13+
lower_bound = input_int;
14+
15+
if (i == -1) {
16+
for (int j = lower_bound; j < input_String.length(); j++)
17+
assert input_String.charAt(j) != input_char;
18+
} else {
19+
assert i >= lower_bound;
20+
assert input_String.charAt(i) == input_char;
21+
22+
for (int j = lower_bound; j < i; j++)
23+
assert input_String.charAt(j) != input_char;
24+
}
25+
return true;
26+
}
27+
28+
public boolean check2() {
29+
// Verification should fail, this is to check the solver does
30+
// not get a contradiction
31+
int i = "hello".indexOf('o', 1);
32+
assert i == 4;
33+
i = "hello".indexOf('h', 1);
34+
assert i == -1;
35+
i = "hello".indexOf('e', 4);
36+
assert i == -1;
37+
i = "hello".indexOf('e', 8);
38+
assert i == -1;
39+
i = "hello".indexOf('x', 0);
40+
assert i == -1;
41+
i = "hello".indexOf('h', -1000);
42+
assert i == 0;
43+
assert false;
44+
return true;
45+
}
46+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
Test.class
3+
--refine-strings --function Test.check --unwind 4 --string-max-length 3 --java-assume-inputs-non-null
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
Test.class
3+
--refine-strings --function Test.check2 --unwind 10 --string-max-length 10 --java-assume-inputs-non-null
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion at file Test.java line 32 .* SUCCESS
7+
assertion at file Test.java line 34 .* SUCCESS
8+
assertion at file Test.java line 36 .* SUCCESS
9+
assertion at file Test.java line 38 .* SUCCESS
10+
assertion at file Test.java line 40 .* SUCCESS
11+
assertion at file Test.java line 42 .* SUCCESS
12+
assertion at file Test.java line 43 .* FAILURE
13+
^VERIFICATION FAILED$
14+
--
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
THOROUGH
2+
Test.class
3+
--refine-strings --function Test.check --unwind 10 --string-max-length 10 --java-assume-inputs-non-null
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
Binary file not shown.

regression/jbmc-strings/StringLastIndexOf/Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void check(String input_String1, String input_String2, int i) {
1313
// Contradiction with the previous condition (should fail).
1414
assert "foo".lastIndexOf("") != 3;
1515
} else if (i == 2 && input_String2.length() > 0) {
16-
int lio = input_String1.lastIndexOf(input_String2.charAt(0), fromIndex);
16+
int lio = input_String1.lastIndexOf(org.cprover.CProverString.charAt(input_String2, 0), fromIndex);
1717
if (input_String2.length() == 0)
1818
assert lio == fromIndex;
1919
} else if (i == 3) {
Binary file not shown.

regression/jbmc-strings/StringMiscellaneous04/StringMiscellaneous04.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ public static char[] toCharArray(String s)
88
char arr[]=new char[s.length()];
99
// We limit arbitrarly the loop unfolding to 10
1010
for(int i=0; i<length && i<10; i++)
11-
arr[i]=s.charAt(i);
11+
arr[i]=org.cprover.CProverString.charAt(s, i);
1212
return arr;
1313
}
1414

1515
public static void main(String[] args)
1616
{
1717
String s1 = "diffblue";
1818
String s2 = "TESTGENERATION";
19-
String s3 = " automated ";
19+
String s3 = " automated ";
2020

2121
assert s1.equals("diffblue");
2222
assert s2.equals("TESTGENERATION");
23-
assert s3.equals(" automated ");
23+
assert s3.equals(" automated ");
2424

2525
System.out.printf(
2626
"Replace 'f' with 'F' in s1: %s\n\n", s1.replace('f', 'F'));
@@ -43,7 +43,7 @@ public static void main(String[] args)
4343
int i=0;
4444
for (char character : charArray)
4545
{
46-
assert character=="diffblue".charAt(i);
46+
assert character==org.cprover.CProverString.charAt("diffblue", i);
4747
++i;
4848
}
4949

0 commit comments

Comments
 (0)