Skip to content

Commit 602d9db

Browse files
authored
Merge pull request diffblue#410 from diffblue/smowton/merge/20180511
Smowton/merge/20180511
2 parents 6d2e37d + b7c2017 commit 602d9db

File tree

372 files changed

+5611
-7150
lines changed

Some content is hidden

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

372 files changed

+5611
-7150
lines changed

cbmc/.gitignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ Release/*
3030
*.lib
3131
src/ansi-c/arm_builtin_headers.inc
3232
src/ansi-c/clang_builtin_headers.inc
33+
src/ansi-c/cprover_builtin_headers.inc
3334
src/ansi-c/cprover_library.inc
3435
src/ansi-c/cw_builtin_headers.inc
36+
src/ansi-c/gcc_builtin_headers_types.inc
3537
src/ansi-c/gcc_builtin_headers_alpha.inc
3638
src/ansi-c/gcc_builtin_headers_arm.inc
3739
src/ansi-c/gcc_builtin_headers_generic.inc
@@ -46,6 +48,7 @@ src/ansi-c/gcc_builtin_headers_tm.inc
4648
src/ansi-c/gcc_builtin_headers_mips.inc
4749
src/ansi-c/gcc_builtin_headers_power.inc
4850
src/ansi-c/gcc_builtin_headers_ubsan.inc
51+
src/ansi-c/windows_builtin_headers.inc
4952
src/java_bytecode/java_core_models.inc
5053

5154
# regression/test files
@@ -105,8 +108,8 @@ src/goto-instrument/goto-instrument.exe
105108
src/jbmc/jbmc
106109
src/musketeer/musketeer
107110
src/musketeer/musketeer.exe
108-
src/solvers/smt2/smt2_solver
109-
src/solvers/smt2/smt2_solver.exe
111+
src/solvers/smt2_solver
112+
src/solvers/smt2_solver.exe
110113
src/symex/symex
111114
src/symex/symex.exe
112115
src/goto-diff/goto-diff

cbmc/.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
script: scripts/travis_lint.sh
3939
before_cache:
4040

41+
- &string-table-check
42+
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
43+
env: NAME="string-table"
44+
install:
45+
script: scripts/string_table_check.sh
46+
before_cache:
47+
4148
- stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
4249
env: NAME="DOXYGEN-CHECK"
4350
addons:
@@ -280,3 +287,14 @@ script:
280287

281288
before_cache:
282289
- ccache -s
290+
291+
notifications:
292+
webhooks:
293+
urls:
294+
- http://dashboard.diffblue.com/api/travis-webhooks
295+
on_success: always
296+
on_failure: always
297+
on_start: never
298+
on_cancel: never
299+
on_error: always
300+

cbmc/CHANGELOG

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
generate bodies for functions that don't have a body
55
in the goto code. This supercedes the functionality
66
of --undefined-function-is-assume-false
7+
* The --fixedbv command-line option has been removed
8+
(it was marked deprecated in January 2017)
9+
710

811
5.8
912
===

cbmc/CODING_STANDARD.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Formatting is enforced using clang-format. For more information about this, see
1919
- Nested function calls do not need to be broken up into separate lines
2020
even if the outer function call does.
2121
- If a method is bigger than 50 lines, break it into parts.
22-
- Put matching `{ }` into the same column.
22+
- Put matching `{ }` into the same column, except for initializer lists and
23+
lambdas, where you should place `{` directly after the closing `)`. This is
24+
to comply with clang-format, which doesn't support aligned curly braces in
25+
these cases.
2326
- Spaces around binary operators (`=`, `+`, `==` ...)
2427
- Space after comma (parameter lists, argument lists, ...)
2528
- Space after colon inside `for`

cbmc/regression/ansi-c/float_constant1/main.c

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ STATIC_ASSERT(0X1.0P-95F == 2.524355e-29f);
1010
// nothing before the dot
1111
STATIC_ASSERT(0X.0p+1f == 0);
1212

13+
// 32-bit, 64-bit and 128-bit constants, GCC proper only,
14+
// clang doesn't have it
15+
#if defined(__GNUC__) && !defined(__clang__)
16+
STATIC_ASSERT(__builtin_types_compatible_p(_Float32, __typeof(1.0f32)));
17+
STATIC_ASSERT(__builtin_types_compatible_p(_Float64, __typeof(1.0f64)));
18+
STATIC_ASSERT(__builtin_types_compatible_p(_Float128, __typeof(1.0f128)));
19+
STATIC_ASSERT(__builtin_types_compatible_p(_Float32x, __typeof(1.0f32x)));
20+
STATIC_ASSERT(__builtin_types_compatible_p(_Float64x, __typeof(1.0f64x)));
21+
STATIC_ASSERT(__builtin_types_compatible_p(_Float128x, __typeof(1.0f128x)));
22+
#endif
23+
1324
#ifdef __GNUC__
1425
_Complex c;
1526
#endif

cbmc/regression/ansi-c/gcc_types_compatible_p1/main.c

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ STATIC_ASSERT(!__builtin_types_compatible_p(unsigned, signed));
9797

9898
#ifndef __clang__
9999
// clang doesn't have these
100+
STATIC_ASSERT(!__builtin_types_compatible_p(_Float32, float));
101+
STATIC_ASSERT(!__builtin_types_compatible_p(_Float64, double));
102+
STATIC_ASSERT(!__builtin_types_compatible_p(_Float32x, float));
103+
STATIC_ASSERT(!__builtin_types_compatible_p(_Float64x, double));
100104
STATIC_ASSERT(!__builtin_types_compatible_p(__float80, double));
101105
STATIC_ASSERT(!__builtin_types_compatible_p(__float128, long double));
102106
STATIC_ASSERT(!__builtin_types_compatible_p(__float128, double));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <stdlib.h>
2+
#include <pthread.h>
3+
4+
_Bool set_done;
5+
int *ptr;
6+
7+
void *set_x(void *arg)
8+
{
9+
*(int *)arg = 10;
10+
set_done = 1;
11+
}
12+
13+
int main(int argc, char *argv[])
14+
{
15+
__CPROVER_assume(argc >= sizeof(int));
16+
ptr = malloc(argc);
17+
__CPROVER_ASYNC_1: set_x(ptr);
18+
__CPROVER_assume(set_done);
19+
assert(*ptr == 10);
20+
return 0;
21+
}
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+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"$<TARGET_FILE:jbmc>"
3+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
default: tests.log
2+
3+
test:
4+
@../test.pl -p -c ../../../src/jbmc/jbmc
5+
6+
tests.log: ../test.pl
7+
@../test.pl -p -c ../../../src/jbmc/jbmc
8+
9+
show:
10+
@for dir in *; do \
11+
if [ -d "$$dir" ]; then \
12+
vim -o "$$dir/*.java" "$$dir/*.out"; \
13+
fi; \
14+
done;
15+
16+
clean:
17+
find -name '*.out' -execdir $(RM) '{}' \;
18+
find -name '*.gb' -execdir $(RM) '{}' \;
19+
$(RM) tests.log
20+
21+
%.class: %.java ../../src/org.cprover.jar
22+
javac -g -cp ../../src/org.cprover.jar:. $<
23+
24+
nondet_java_files := $(shell find . -name "Nondet*.java")
25+
nondet_class_files := $(patsubst %.java, %.class, $(nondet_java_files))
26+
27+
.PHONY: nondet-class-files
28+
nondet-class-files: $(nondet_class_files)
29+
30+
.PHONY: clean-nondet-class-files
31+
clean-nondet-class-files:
32+
-rm $(nondet_class_files)
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import java.lang.Thread;
2+
import org.cprover.CProver;
3+
4+
public class A
5+
{
6+
static int x = 0;
7+
8+
// verification success
9+
public void me()
10+
{
11+
x = 5;
12+
CProver.startThread(333);
13+
x = 10;
14+
CProver.endThread(333);
15+
assert(x == 5 || x == 10);
16+
}
17+
18+
// verification failed
19+
public void me2()
20+
{
21+
x = 5;
22+
CProver.startThread(333);
23+
x = 10;
24+
CProver.endThread(333);
25+
assert(x == 10);
26+
}
27+
28+
// Known-bug, thread id mismatch, this should be detected by the conversation
29+
// process. It is currently not and thus will result in an assertion violation
30+
// during symbolic execution.
31+
public void me3()
32+
{
33+
x = 5;
34+
CProver.startThread(22333);
35+
x = 10;
36+
CProver.endThread(333);
37+
assert(x == 10);
38+
}
39+
40+
// Known-bug, see: https://github.com/diffblue/cbmc/issues/1630
41+
public void me4()
42+
{
43+
int x2 = 10;
44+
CProver.startThread(22333);
45+
x = x2;
46+
assert(x == 10);
47+
CProver.endThread(333);
48+
}
49+
50+
// Known-bug, symex cannot handle nested thread-blocks
51+
public void me5()
52+
{
53+
CProver.startThread(333);
54+
x = 5;
55+
CProver.startThread(222);
56+
x = 8;
57+
CProver.endThread(222);
58+
CProver.endThread(333);
59+
assert(x == 5 || x == 0 || x == 8);
60+
}
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
A.class
3+
--function "A.me:()V" --lazy-methods --java-threading
4+
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
^VERIFICATION SUCCESSFUL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
A.class
3+
--function "A.me2:()V" --lazy-methods --java-threading
4+
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED
Binary file not shown.
624 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@interface FieldAnnotation {
2+
}
3+
4+
public class Test {
5+
@FieldAnnotation
6+
public static double d;
7+
8+
public void check() {
9+
double f = d;
10+
assert(f == d);
11+
assert(f != d);
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
Test.class
3+
--function Test.check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion at file Test.java line 10 .* SUCCESS
7+
assertion at file Test.java line 11 .* FAILURE
8+
--
9+
--
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class A {
2+
public float a;
3+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class FloatMultidim1 {
2+
public float[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
float[][] a1 = new float[y][2];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[j][1] = 1.0f;
12+
return a1;
13+
} else {
14+
return null;
15+
}
16+
}
17+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class FloatMultidim2 {
2+
public float[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
float[][] a1 = new float[2][y];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[1][j] = 1.0f;
12+
return a1;
13+
} else {
14+
return new float[1][1];
15+
}
16+
}
17+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class RefMultidim1 {
2+
public A[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
A[][] a1 = new A[y][2];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[j][1] = new A();
12+
a1[j][1].a = 1.0f;
13+
return a1;
14+
} else {
15+
return null;
16+
}
17+
}
18+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class RefMultidim2 {
2+
public A[][] f(int y) {
3+
if (y > 0 && y < 5) {
4+
A[][] a1 = new A[2][y];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[1][j] = new A();
12+
a1[1][j].a = 1.0f;
13+
return a1;
14+
} else {
15+
return null;
16+
}
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class RefMultidimConstsize {
2+
public void f(int y) {
3+
A[][] a1 = new A[2][2];
4+
int j = 1;
5+
a1[j][1] = new A();
6+
a1[j][1].a = 1.0f;
7+
}
8+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class RefSingledim {
2+
public A[] f(int y) {
3+
if (y > 0 && y < 5) {
4+
A[] a1 = new A[y];
5+
int j;
6+
if (y > 1) {
7+
j = 1;
8+
} else {
9+
j = 0;
10+
}
11+
a1[j] = new A();
12+
a1[j].a = 1.0f;
13+
return a1;
14+
} else {
15+
return null;
16+
}
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
FloatMultidim1.class
3+
--function FloatMultidim1.f --cover location --unwind 3
4+
\d+ of \d+ covered
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
9+
This crashes during symex, with error 'cannot unpack array of nonconst size'
10+
when trying to access the element of the array. Symex uses byte_extract_little
11+
_endian to access the element which does not get simplified (it seems the
12+
problem is that the types in the instruction do not match). TG-1121

0 commit comments

Comments
 (0)