Skip to content

Commit 2f21b81

Browse files
author
Owen Jones
committed
Squashed 'cbmc/' changes from ad62682..31c47c2
31c47c2 Merge pull request diffblue#2113 from diffblue/java_new_array_data fb3025d Merge pull request diffblue#2107 from thk123/feature/TG-3271/interpreter-tracking-mock-exceptions 32bf48e Merge pull request diffblue#2105 from tautschnig/determinise-test 7254a2a show java_new_array_data side effects 0f1482c Merge pull request diffblue#2094 from smowton/smowton/fix/tmp-object-factory-prefix 3cfec66 Merge pull request diffblue#2106 from diffblue/ptrmember_on_array bf4c39c Merge pull request diffblue#1966 from JohnDumbell/JohnDumbell/Update-Assertion-Validation 74a37c6 Merge pull request diffblue#1988 from tautschnig/cadical 74dc576 Merge pull request diffblue#2003 from tautschnig/bitfield-offset 8916906 Merge pull request diffblue#2008 from tautschnig/section-bug 0bd83ab Extension to interpreter class a0ca0ba fix array->f typechecking e1f4120 Make virtual function resolution independent of string table entry ordering 714ccff Merge pull request diffblue#2072 from danpoe/feature/small-shared-two-way-ptr 16b6c20 Merge pull request diffblue#2046 from thk123/gs_tg2922 04cb909 Merge pull request diffblue#2102 from thk123/formatting/sort-includes-clang-format 7070ba1 Sort includes using clang-format 9874a6b Reformatting touched output function f2a4054 Remove redundant default constructor 54fb9ab Use format rather than from_expr for output 781bf7c Introduce exceptions for all conversion steps. 21997b2 Add documentation to convert_bitvector 015b284 Test demonstrating logging with clause for dealing with Windows 9d41b0c Disable nested exception printing for Windows b866015 Provide the original goto statement in the error a97bc28 Introduce throwing a guard conversion exception 12f25c2 Introduce throwing bv_conversion expection 9bd5222 Convert flatten_byte_extract to use structured exceptions 3207291 Introduce nested exception printing 35c4be7 Small shared two way pointer 7d247da Merge pull request diffblue#2099 from mgudemann/bugfix/build/glucose_syrup 1776a9e Merge pull request diffblue#1950 from romainbrenguier/refactor/prop_conv_straightforward 4147243 Change set_variable_name API to consume irep_idt 2d8be06 Rename `it` to pair in boolbvt::print_assignment 4365c28 Simplify boolbvt::set_to b18109f Make make_(free_)bv_expr return exprt 5724a35 Simplify loop in prop_conv::get 4987f3a Remove useless comments 13e87a9 Simplify dec_solve a0500f6 Use standard algorithm for finding an element ba13c94 Use auto for iterator types 9179571 Remove useless includes a905a07 Replace throws by invariant or preconditions 7db44fc Remove virtual keyword where not needed 990f33e Initialize at declaration instead of construction c1a93b3 Renaming `it` to symbol 8eb20f6 Use ranged for dc799e0 Assert replaced by unreachable c34e073 Add support for CaDiCaL 1bd9efd Merge pull request diffblue#2097 from peterschrammel/java-cleanup-replace a079f46 Clang-format moved file 2eb3714 Move replace_java_nondet to java_bytecode 9a8c292 Remove unnecessary include c8cf100 Remove Java refs from ANSI-C docs 0090952 Merge pull request diffblue#2096 from diffblue/cleanout-java aa3caa3 Fix CMake build for Glucose Syrup 1156930 Merge pull request diffblue#1244 from tautschnig/goto-gcc-at-fix 706e391 Merge pull request diffblue#2093 from owen-jones-diffblue/owen-jones-diffblue/remove_unnecessary_irep_id_hash 290feb4 Merge pull request diffblue#2095 from diffblue/get_json_stream_precondition ac2df21 Merge pull request diffblue#2027 from tautschnig/linking-multiple-conflicts dd0d602 Merge pull request diffblue#2030 from tautschnig/goto-cc-linux-kernel 42e58d4 Merge pull request diffblue#2085 from tautschnig/from_expr-cleanup 692f92d remove dependency on java_bytecode 8c6165d precondition for get_json_stream() e28a662 Remove unused typedef 5626fb7 Merge pull request diffblue#2092 from smowton/smowton/cleanup/diffblue-spelling 4840154 Replace stack by deque and use range-based for loop 987edbe Use range-based for loops 92ac82c Remove redundant irep_id_hash for unordered maps dc2b436 Remove redundant irep_id_hash for sets 5aa2c2d Attribute main function arguments to __CPROVER_start b7ef5af Merge pull request diffblue#2053 from owen-jones-diffblue/owen-jones-diffblue/bugfix/make-callgraph-include-uncalled-functions 252474f String tests: DiffBlue -> Diffblue de1915a Merge pull request diffblue#2074 from owen-jones-diffblue/owen-jones-diffblue/lazy-methods-no-candidate-callees d73f6bc Make directed callgraph include nodes with no edges 2a45e61 Only the top-level section should be considered for renaming 9c66a66 fixup! Support __attribute__((section("x")) e133964 C front-end: Section/ASM renaming also needs to be applied to aliases 0cfc72f Test --call-graph and --reachable-call-graph 1c34d22 Test lazy-loading when there are no candidates 289a439 Deal with virtual function calls with no candidate targets 9347615 Remove incorrect comment 18b1962 Fix order of parameters in function header 82058da Store virtual function calls instead of virtual call-sites 3653550 Use unordered set of irep_ids in ci_lazy_methods c31d43f Remove code duplication 945f885 Rename two variables and make one more local b7d70e7 Replace do-while loop with equally valid while loop 58b990d Use from_{expr,type} matching the language of the expression/type 177c8c1 goto-cc: support thin ar archives, refactoring e80008e goto-cc: support GCC's print-sysroot* options 38e6fa5 Accept the --build-id option in goto-ld f3bbb12 Linking: report multiple conflicts 495f109 Fixing member offset computation in presence of bitfields 5109eab Add @<file> arguments to the original command line 97d556e Update desc file to add pass variables. eea76ec Add a regression test. c14e907 Increase AssertionError arguments allowed from 2 to 3 git-subtree-dir: cbmc git-subtree-split: 31c47c2
1 parent 7420f4a commit 2f21b81

File tree

207 files changed

+2694
-960
lines changed

Some content is hidden

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

207 files changed

+2694
-960
lines changed

.clang-format

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ NamespaceIndentation: None
8484
PenaltyBreakString: 10000
8585
PointerAlignment: Right
8686
ReflowComments: 'false'
87-
SortIncludes: 'false'
87+
SortIncludes: 'true'
8888
SpaceAfterCStyleCast: 'false'
8989
SpaceBeforeAssignmentOperators: 'true'
9090
SpaceBeforeParens: Never
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
struct some_struct
2+
{
3+
int some_field;
4+
} array[10];
5+
6+
int main()
7+
{
8+
array[0].some_field=1;
9+
array->some_field=1;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifdef __GNUC__
2+
// example extracted from SV-COMP's ldv-linux-3.4-simple/
3+
// 32_7_cpp_false-unreach-call_single_drivers-net-phy-dp83640
4+
static int __attribute__((__section__(".init.text")))
5+
__attribute__((no_instrument_function)) dp83640_init(void)
6+
{
7+
return 0;
8+
}
9+
int init_module(void) __attribute__((alias("dp83640_init")));
10+
#endif
11+
12+
int main()
13+
{
14+
#ifdef __GNUC__
15+
dp83640_init();
16+
#endif
17+
return 0;
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

regression/ansi-c/gcc_attributes9/main.c

+12
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,23 @@ const char* __attribute__((section("s"))) __attribute__((weak)) bar();
1111
volatile int __attribute__((__section__(".init.data1"))) txt_heap_base1;
1212
volatile int __attribute__((__section__(".init.data3"))) txt_heap_base, __attribute__((__section__(".init.data4"))) txt_heap_size;
1313

14+
int __attribute__((__section__(".init.text"))) __attribute__((__cold__))
15+
__alloc_bootmem_huge_page(void *h);
16+
int __attribute__((__section__(".init.text"))) __attribute__((__cold__))
17+
alloc_bootmem_huge_page(void *h);
18+
int alloc_bootmem_huge_page(void *h)
19+
__attribute__((weak, alias("__alloc_bootmem_huge_page")));
20+
int __alloc_bootmem_huge_page(void *h)
21+
{
22+
return 1;
23+
}
1424
#endif
1525

1626
int main()
1727
{
1828
#ifdef __GNUC__
29+
int r = alloc_bootmem_huge_page(0);
30+
1931
static int __attribute__((section(".data.unlikely"))) __warned;
2032
__warned=1;
2133
return __warned;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int bar()
2+
{
3+
return 0;
4+
}
5+
6+
int bar2()
7+
{
8+
return 0;
9+
}
10+
11+
int main()
12+
{
13+
unsigned x = foo();
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
void bar()
2+
{
3+
}
4+
5+
void bar2()
6+
{
7+
}
8+
9+
unsigned foo()
10+
{
11+
return 0;
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
other.c
4+
^EXIT=(64|1)$
5+
^SIGNAL=0$
6+
^CONVERSION ERROR$
7+
error: conflicting function declarations `bar'
8+
error: conflicting function declarations `bar2'
9+
--
10+
^warning: ignoring
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class AssertionIssue {
2+
3+
public static void throwAssertion() {
4+
throw new AssertionError("Something went terribly wrong.", new ThrowableAssertion());
5+
}
6+
7+
public static class ThrowableAssertion extends Throwable {
8+
@Override
9+
public String getMessage() {
10+
return "How did we get here?";
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
AssertionIssue.class
3+
--function AssertionIssue.throwAssertion
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class TestClass {
2+
public static void f(int y) {
3+
float[][] a1 = new float[y][3];
4+
int j = 0;
5+
a1[j][0] = 34.5f;
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
TestClass.class
3+
--function TestClass.f --cover location --unwind 2
4+
Source GOTO statement: .*
5+
(^ exception: Can't convert byte_extraction|Nested exception printing not supported on Windows)
6+
^EXIT=6$
7+
--
8+
--
9+
The exception thrown in this test is the symptom of a bug; the purpose of this
10+
test is the validate the output of that exception
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class Test {
2+
3+
interface factory_intf {
4+
public intf getintf();
5+
}
6+
7+
interface intf {
8+
public void f();
9+
}
10+
11+
public static void main(factory_intf i) { i.getintf().f(); }
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
Test.class
3+
--lazy-methods --show-goto-functions --verbosity 10 --function Test.main
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^CI lazy methods: elaborate java::Test\$intf\.f:\(\)V$
7+
Test\$intf\.f:\(\)V\(\);$
8+
--
9+
--
10+
This doesn't work under symex-driven lazy loading because it is incompatible with --lazy-methods

regression/cbmc-java/virtual7/test.desc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ test.class
33
--show-goto-functions --function test.main
44
^EXIT=0$
55
^SIGNAL=0$
6-
IF.*"java::C".*THEN GOTO
7-
IF.*"java::D".*THEN GOTO
6+
IF.*"java::B".*THEN GOTO
7+
IF.*"java::E".*THEN GOTO
88
IF.*"java::A".*THEN GOTO

regression/cbmc/Bitfields3/main.c

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <stdlib.h>
2+
#include <assert.h>
3+
4+
#pragma pack(1)
5+
struct A
6+
{
7+
unsigned char a;
8+
unsigned char b : 2;
9+
unsigned char c : 2;
10+
unsigned char d;
11+
};
12+
13+
struct B
14+
{
15+
unsigned char a;
16+
unsigned char b : 2;
17+
unsigned char c;
18+
unsigned char d : 2;
19+
};
20+
21+
struct C
22+
{
23+
unsigned char a;
24+
unsigned char b : 4;
25+
unsigned char c : 4;
26+
unsigned char d;
27+
};
28+
#pragma pack()
29+
30+
int main(void)
31+
{
32+
assert(sizeof(struct A) == 3);
33+
struct A *p = malloc(3);
34+
assert((unsigned char *)p + 2 == &(p->d));
35+
p->c = 3;
36+
if(p->c != 3)
37+
{
38+
free(p);
39+
}
40+
free(p);
41+
42+
assert(sizeof(struct B) == 4);
43+
struct B *pb = malloc(4);
44+
assert((unsigned char *)pb + 2 == &(pb->c));
45+
free(pb);
46+
47+
assert(sizeof(struct C) == 3);
48+
struct C *pc = malloc(3);
49+
assert((unsigned char *)pc + 2 == &(pc->d));
50+
free(pc);
51+
52+
return 0;
53+
}

regression/cbmc/Bitfields3/test.desc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--pointer-check --bounds-check
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

regression/goto-gcc/at_files/args

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
other.c

regression/goto-gcc/at_files/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
int foo();
2+
3+
int main()
4+
{
5+
return foo();
6+
}

regression/goto-gcc/at_files/other.c

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int foo()
2+
{
3+
return 1;
4+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
@args
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
2+
int x;
3+
4+
void func0()
5+
{
6+
func0();
7+
}
8+
9+
void func1()
10+
{
11+
x = 1;
12+
}
13+
14+
void func2()
15+
{
16+
x = 2;
17+
func3();
18+
}
19+
20+
void func3()
21+
{
22+
x = 3;
23+
}
24+
25+
void func4(int b)
26+
{
27+
x = 4;
28+
if(b)
29+
{
30+
func5(0);
31+
}
32+
}
33+
34+
void func5(int b)
35+
{
36+
x = 5;
37+
func4(b);
38+
}
39+
40+
void func6()
41+
{
42+
x = 6;
43+
}
44+
45+
void func7(int b)
46+
{
47+
x = 7;
48+
if(b)
49+
{
50+
func8(0);
51+
}
52+
}
53+
54+
void func8(int b)
55+
{
56+
x = 8;
57+
func7(b);
58+
}
59+
60+
void func9()
61+
{
62+
x = 9;
63+
funca();
64+
}
65+
66+
void funca()
67+
{
68+
x = 10;
69+
func9();
70+
}
71+
72+
73+
74+
int main()
75+
{
76+
func1();
77+
func2();
78+
func4(1);
79+
80+
return 0;
81+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CORE
2+
main.c
3+
--call-graph
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^main -> func2$
7+
^main -> func1$
8+
^main -> func4$
9+
^funca -> func9$
10+
^func9 -> funca$
11+
^func8 -> func7$
12+
^func7 -> func8$
13+
^__CPROVER__start -> __CPROVER_initialize$
14+
^__CPROVER__start -> main$
15+
^func2 -> func3$
16+
^func0 -> func0$
17+
^func4 -> func5$
18+
^func5 -> func4$
19+
--
20+
^warning: ignoring

0 commit comments

Comments
 (0)