Skip to content

Commit 5648db1

Browse files
Merge latest changes from develop to Security Scanner Support
2 parents 52eb7ed + 34492db commit 5648db1

File tree

171 files changed

+3184
-1105
lines changed

Some content is hidden

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

171 files changed

+3184
-1105
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ install:
160160
eval ${PRE_COMMAND} ${COMMAND}
161161
- COMMAND="make -C src boost-download" &&
162162
eval ${PRE_COMMAND} ${COMMAND}
163+
- COMMAND="make -C src/ansi-c library_check" &&
164+
eval ${PRE_COMMAND} ${COMMAND}
163165
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g -DUSE_BOOST $EXTRA_CXXFLAGS\" -j2" &&
164166
eval ${PRE_COMMAND} ${COMMAND}
165167
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"$FLAGS $EXTRA_CXXFLAGS\" -j2 clobber.dir memory-models.dir musketeer.dir" &&

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* GOTO-INSTRUMENT: New option --remove-function-body
1111
* GOTO-INSTRUMENT: New option --use-all-headers, changed --use-system-headers to
1212
--no-system-headers
13+
* GOTO-INSTRUMENT: dump-c can output the generated environment via --harness
1314

1415

1516
5.7

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ test_script:
109109
rmdir /s /q cbmc-java\classpath1
110110
rmdir /s /q cbmc-java\jar-file3
111111
rmdir /s /q cbmc-java\tableswitch2
112+
rmdir /s /q goto-gcc
112113
rmdir /s /q goto-instrument\slice08
113114
114115
make test

regression/Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
DIRS = ansi-c \
22
cbmc \
3-
cpp \
3+
cbmc-cover \
44
cbmc-java \
55
cbmc-java-inheritance \
6+
cpp \
67
goto-analyzer \
78
goto-diff \
9+
goto-gcc \
810
goto-instrument \
911
goto-instrument-typedef \
1012
invariants \
@@ -13,9 +15,14 @@ DIRS = ansi-c \
1315
test-script \
1416
# Empty last line
1517

16-
18+
# Check for the existence of $dir. Tests under goto-gcc cannot be run on
19+
# Windows, so appveyor.yml unlinks the entire directory under Windows.
1720
test:
18-
$(foreach var,$(DIRS), $(MAKE) -C $(var) test || exit 1;)
21+
@for dir in $(DIRS); do \
22+
if [ -d "$$dir" ]; then \
23+
$(MAKE) -C "$$dir" test || exit 1; \
24+
fi; \
25+
done;
1926

2027
clean:
2128
@for dir in *; do \

regression/ansi-c/Union_Padding1/main.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,33 @@ STATIC_ASSERT(sizeof(union some_union4)==3);
6262

6363
#endif
6464

65+
#ifdef _MSC_VER
66+
67+
union some_union5
68+
{
69+
int i;
70+
};
71+
72+
STATIC_ASSERT(__alignof(union some_union5)==1);
73+
74+
#else
75+
76+
union some_union5
77+
{
78+
int i;
79+
};
80+
81+
union some_union6
82+
{
83+
int i;
84+
} __attribute__((__packed__));
85+
86+
// Packing may affect alignment
87+
STATIC_ASSERT(_Alignof(union some_union5)==4);
88+
STATIC_ASSERT(_Alignof(union some_union6)==1);
89+
90+
#endif
91+
6592
int main()
6693
{
6794
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
static unsigned bar()
2+
{
3+
unsigned r;
4+
return r;
5+
}
6+
7+
#ifdef _MSC_VER
8+
9+
static void foo()
10+
{
11+
}
12+
13+
#else
14+
15+
static void foo()
16+
{
17+
unsigned len=bar();
18+
struct {
19+
int a;
20+
union {
21+
int s;
22+
unsigned char b[len];
23+
} __attribute__ (( packed )) S;
24+
int c;
25+
} __attribute__ (( packed )) *l;
26+
}
27+
28+
#endif
29+
30+
int main()
31+
{
32+
foo();
33+
return 0;
34+
}
Lines changed: 8 additions & 0 deletions
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$
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extern char src_start[];
2+
extern char src_end[];
3+
extern char dst_start[];
4+
5+
void *memcpy(void *dest, void *src, unsigned n){
6+
return (void *)0;
7+
}
8+
9+
int main(){
10+
memcpy(dst_start, src_start, (unsigned)src_end - (unsigned)src_start);
11+
return 0;
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MEMORY {
2+
RAM : ORIGIN = 0x0, LENGTH = 25M
3+
}
4+
5+
SECTIONS
6+
{
7+
/* GCC insists on having these */
8+
.note.gnu.build-id : { } > RAM
9+
.text : { } > RAM
10+
11+
.src_section : {
12+
src_start = .;
13+
*(.text*)
14+
src_end = .;
15+
} > RAM
16+
17+
.dst_section : {
18+
dst_start = .;
19+
*(.text*)
20+
dst_end = .;
21+
} > RAM
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CORE
2+
main.c
3+
-o out.gb -T script.ld -nostdlib
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
9+
--
10+
Tesing the functionality of goto-cc's linker script parsing
11+
functionality, ensuring that it can get the values of symbols that are
12+
defined in linker scripts.
13+
14+
This test ensures that goto-cc and ls-parse can:
15+
16+
- get the value of a symbol whose value indicates the start of a section;
17+
- get the value of a symbol whose value indicates the end of a section.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extern char src_start[];
2+
extern char src_size[];
3+
extern char dst_start[];
4+
5+
void *memcpy(void *dest, void *src, unsigned n){
6+
return (void *)0;
7+
}
8+
9+
int main(){
10+
memcpy(dst_start, src_start, (unsigned)src_size);
11+
return 0;
12+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
MEMORY {
3+
RAM : ORIGIN = 0x0, LENGTH = 25M
4+
}
5+
6+
SECTIONS
7+
{
8+
/* GCC insists on having these */
9+
.note.gnu.build-id : { } > RAM
10+
.text : { } > RAM
11+
12+
.src_section : {
13+
src_start = .;
14+
*(.text*)
15+
src_end = .;
16+
} > RAM
17+
18+
src_size = src_end - src_start;
19+
20+
.dst_section : {
21+
dst_start = .;
22+
*(.text*)
23+
dst_end = .;
24+
} > RAM
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CORE
2+
main.c
3+
-o out.gb -T script.ld -nostdlib
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
9+
--
10+
Tesing the functionality of goto-cc's linker script parsing
11+
functionality, ensuring that it can get the values of symbols that are
12+
defined in linker scripts.
13+
14+
This test ensures that goto-cc and ls-parse can:
15+
16+
- get the value of a symbol whose value indicates the start of a section;
17+
- get the value of a symbol whose value indicates the size of a section,
18+
and whose value has been generated through a basic arithmetic
19+
expression in the linker script.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extern char sym[];
2+
3+
int main(){
4+
int foo = (int)sym;
5+
return 0;
6+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
MEMORY {
2+
RAM : ORIGIN = 0x0, LENGTH = 25M
3+
}
4+
5+
SECTIONS
6+
{
7+
/* GCC insists on having these */
8+
.note.gnu.build-id : { } > RAM
9+
.text : { } > RAM
10+
11+
.src_section : {
12+
sym = .;
13+
*(.text*)
14+
} > RAM
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
main.c
3+
-o out.gb -T script.ld -nostdlib
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
9+
--
10+
Tesing the functionality of goto-cc's linker script parsing
11+
functionality, ensuring that it can get the values of symbols that are
12+
defined in linker scripts.
13+
14+
This test ensures that goto-cc and ls-parse can get the value of a
15+
symbol whose value indicates the start of a section.

regression/cbmc-cover/assertion1/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ int main()
55
__CPROVER_input("input1", input1);
66
__CPROVER_input("input2", input2);
77

8+
// assert() is platform-dependent and changes set of coverage goals
89
__CPROVER_assert(!input1, "");
910

1011
if(input1)

regression/cbmc-cover/assertion1/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--cover assertion
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[main.coverage.1\] file main.c line 8 function main: SATISFIED$
7-
^\[main.coverage.2\] file main.c line 12 function main: SATISFIED$
6+
^\[main.coverage.1\] file main.c line 9 function main: SATISFIED$
7+
^\[main.coverage.2\] file main.c line 13 function main: SATISFIED$
88
--
99
^warning: ignoring

regression/cbmc-cover/branch1/test.desc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ main.c
33
--cover branch
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[main.coverage.1\] file main.c line 3 function main function main entry point: SATISFIED$
7-
^\[main.coverage.2\] file main.c line 8 function main function main block 1 branch false: SATISFIED$
8-
^\[main.coverage.3\] file main.c line 8 function main function main block 1 branch true: SATISFIED$
9-
^\[main.coverage.4\] file main.c line 10 function main function main block 2 branch false: FAILED$
10-
^\[main.coverage.5\] file main.c line 10 function main function main block 2 branch true: SATISFIED$
11-
^\[main.coverage.6\] file main.c line 16 function main function main block 4 branch false: SATISFIED$
12-
^\[main.coverage.7\] file main.c line 16 function main function main block 4 branch true: SATISFIED$
6+
^\[main.coverage.1\] file main.c line 3 function main entry point: SATISFIED$
7+
^\[main.coverage.2\] file main.c line 8 function main block 1 branch false: SATISFIED$
8+
^\[main.coverage.3\] file main.c line 8 function main block 1 branch true: SATISFIED$
9+
^\[main.coverage.4\] file main.c line 10 function main block 2 branch false: FAILED$
10+
^\[main.coverage.5\] file main.c line 10 function main block 2 branch true: SATISFIED$
11+
^\[main.coverage.6\] file main.c line 16 function main block 4 branch false: SATISFIED$
12+
^\[main.coverage.7\] file main.c line 16 function main block 4 branch true: SATISFIED$
1313
--
1414
^warning: ignoring

regression/cbmc-cover/branch2/test.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ main.c
33
--cover branch --unwind 2
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[main.coverage.1\] file main.c line 5 function main function main entry point: SATISFIED$
7-
^\[main.coverage.2\] file main.c line 6 function main function main block .* branch false: SATISFIED$
8-
^\[main.coverage.3\] file main.c line 6 function main function main block .* branch true: SATISFIED$
6+
^\[main.coverage.1\] file main.c line 5 function main entry point: SATISFIED$
7+
^\[main.coverage.2\] file main.c line 6 function main block .* branch false: SATISFIED$
8+
^\[main.coverage.3\] file main.c line 6 function main block .* branch true: SATISFIED$
99
--
1010
^warning: ignoring

regression/cbmc-cover/branch3/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <assert.h>
21
#include <stdio.h>
32

43
int main()

regression/cbmc-cover/branch3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main.c
33
--cover branch --unwind 6
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 23 of 23 covered \(100.0%\)$
6+
^\*\* .* of .* covered \(100.0%\)$
77
--
88
^warning: ignoring

regression/cbmc-cover/built-ins2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--cover location --unwind 10
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 4 of 4 covered
6+
^\*\* .* of .* covered \(100.0%\)
77
--
88
^warning: ignoring
99
^\[.*<builtin-library-

regression/cbmc-cover/cover1/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ int main()
1414
}
1515

1616
// should not produce a goal
17+
// assert() is platform-dependent and changes set of coverage goals
1718
__CPROVER_assert(input1, "");
1819
}

regression/cbmc-cover/inlining1/test.desc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ main.c
33
--cover branch
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[my_func.coverage.1\] file main.c line 3 function my_func function my_func block 1 branch false: SATISFIED$
7-
^\[my_func.coverage.2\] file main.c line 3 function my_func function my_func block 1 branch true: FAILED$
8-
^\[my_func.coverage.3\] file main.c line 3 function my_func function my_func block 2 branch false: FAILED$
9-
^\[my_func.coverage.4\] file main.c line 3 function my_func function my_func block 2 branch true: SATISFIED$
6+
^\[my_func.coverage.1\] file main.c line 3 function my_func block 1 branch false: SATISFIED$
7+
^\[my_func.coverage.2\] file main.c line 3 function my_func block 1 branch true: FAILED$
8+
^\[my_func.coverage.3\] file main.c line 3 function my_func block 2 branch false: FAILED$
9+
^\[my_func.coverage.4\] file main.c line 3 function my_func block 2 branch true: SATISFIED$
1010
--
1111
^warning: ignoring

regression/cbmc-cover/location11/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <assert.h>
2-
31
int myfunc(int x, int y)
42
{
53
int z = x + y;

0 commit comments

Comments
 (0)