Skip to content

Commit 8919fdc

Browse files
authored
Merge pull request #8292 from diffblue/no-body-assertion
generate assert(false) when calling undefined function
2 parents c3e5ba8 + 6c99724 commit 8919fdc

File tree

39 files changed

+108
-117
lines changed

39 files changed

+108
-117
lines changed

doc/man/cbmc.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,6 @@ run full slicer (experimental)
347347
.TP
348348
\fB\-\-drop\-unused\-functions\fR
349349
drop functions trivially unreachable from main function
350-
.TP
351-
\fB\-\-havoc\-undefined\-functions\fR
352-
for any function that has no body, assign non\-deterministic values to
353-
any parameters passed as non\-const pointers and the return value
354350
.SS "Semantic transformations:"
355351
.TP
356352
\fB\-\-nondet\-static\fR

regression/cbmc-cpp/Overloading_Functions4/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
double pow(double _X, double _Y);
22
double pow(double _X, int _Y);
33
float pow(float _X, float _Y);
4-
float pow(float _X, int _Y);
4+
float pow(float _X, int _Y)
5+
{
6+
}
57
long double pow(long double _X, long double _Y);
68
long double pow(long double _X, int _Y);
79

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--pointer-check --bounds-check -D_FORTIFY_SOURCE=2 -D__OPTIMIZE__=2
44
^EXIT=0$
@@ -7,3 +7,5 @@ main.c
77
--
88
^\*\*\*\* WARNING: no body for function __fprintf_chk
99
^warning: ignoring
10+
--
11+
We are missing __builtin_va_arg_pack

regression/cbmc-library/printf-01/__printf_chk.desc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--pointer-check --bounds-check -D_FORTIFY_SOURCE=2 -D__OPTIMIZE__=2
44
^EXIT=10$
@@ -8,3 +8,5 @@ main.c
88
--
99
^\*\*\*\* WARNING: no body for function __printf_chk
1010
^warning: ignoring
11+
--
12+
We are missing __builtin_va_arg_pack
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--pointer-check --bounds-check -D_FORTIFY_SOURCE=2 -D__OPTIMIZE__=2
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
77
--
8-
^\*\*\*\* WARNING: no body for function __syslog_chk
98
^warning: ignoring
9+
--
10+
We are missing __builtin_va_arg_pack

regression/cbmc/Array_UF17/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ int istrchr(const char *s, int c);
3131
int istrrchr(const char *s, int c);
3232
int istrncmp(const char *s1, int start, const char *s2, size_t n);
3333
int istrstr(const char *haystack, const char *needle);
34-
char *r_strncpy(char *dest, const char *src, size_t n);
34+
char *r_strncpy(char *dest, const char *src, size_t n)
35+
{
36+
}
3537
char *r_strcpy(char *dest, const char *src);
3638
char *r_strcat(char *dest, const char *src);
3739
char *r_strncat(char *dest, const char *src, size_t n);

regression/cbmc/Function_Pointer5/main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
// this is a pointer to a function that takes a function pointer as argument
22

3-
void signal1(int, void (*)(int));
4-
void signal2(int, void (*h)(int));
3+
void signal1(int, void (*)(int))
4+
{
5+
}
6+
7+
void signal2(int, void (*h)(int))
8+
{
9+
h(123);
10+
}
511

612
void handler(int x)
713
{

regression/cbmc/Malloc2/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
typedef unsigned int size_t;
1+
typedef __CPROVER_size_t size_t;
22
typedef int ssize_t;
33
typedef int atomic_t;
44
typedef unsigned gfp_t;

regression/cbmc/Pointer28/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE no-new-smt
1+
KNOWNBUG no-new-smt
22
main.c
33
--little-endian
44
^EXIT=0$

regression/cbmc/Promotion4/main.i

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
unsigned nondet_unsigned();
2+
13
int main(int argc, char *argv[])
24
{
35
__CPROVER_assert(sizeof(unsigned int) == 2, "[--16] size of int is 16 bit");
46
__CPROVER_assert(
57
sizeof(unsigned long) == 4, "[--LP32] size of long is 32 bit");
68

7-
unsigned int k = non_det_unsigned();
9+
unsigned int k = nondet_unsigned();
810
__CPROVER_assume(k < 1);
911
__CPROVER_assert(k != 0xffff, "false counter example 16Bit?");
1012

0 commit comments

Comments
 (0)