Skip to content

Commit f398ace

Browse files
committed
Add regression test of __CPROVER_DYNAMIC_OBJECT
1 parent 4d7381e commit f398ace

File tree

6 files changed

+83
-0
lines changed

6 files changed

+83
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <assert.h>
2+
#include <stdbool.h>
3+
#include <stdlib.h>
4+
5+
bool nondet_bool();
6+
7+
void main()
8+
{
9+
char local;
10+
void *pointer = &local;
11+
const bool make_dynamic = nondet_bool();
12+
if(make_dynamic)
13+
{
14+
pointer = malloc(1);
15+
}
16+
assert(__CPROVER_DYNAMIC_OBJECT(pointer));
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
assert_dynamic.c
3+
--trace
4+
Passing problem to incremental SMT2 solving
5+
line 16 assertion __CPROVER_DYNAMIC_OBJECT\(pointer\)\: FAILURE
6+
make_dynamic\=FALSE
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
make_dynamic\=TRUE
11+
--
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <assert.h>
2+
#include <stdbool.h>
3+
#include <stdlib.h>
4+
5+
bool nondet_bool();
6+
7+
void main()
8+
{
9+
char local;
10+
void *pointer = &local;
11+
const bool make_dynamic = nondet_bool();
12+
if(make_dynamic)
13+
{
14+
pointer = malloc(1);
15+
}
16+
assert(!__CPROVER_DYNAMIC_OBJECT(pointer));
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
assert_not_dynamic.c
3+
--trace
4+
Passing problem to incremental SMT2 solving
5+
line 16 assertion \!__CPROVER_DYNAMIC_OBJECT\(pointer\)\: FAILURE
6+
make_dynamic\=TRUE
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
make_dynamic\=FALSE
11+
--
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <assert.h>
2+
#include <stdbool.h>
3+
#include <stdlib.h>
4+
5+
bool nondet_bool();
6+
7+
void main()
8+
{
9+
char local;
10+
void *pointer = &local;
11+
const bool make_dynamic = nondet_bool();
12+
if(make_dynamic)
13+
{
14+
pointer = malloc(1);
15+
}
16+
assert(make_dynamic || !__CPROVER_DYNAMIC_OBJECT(pointer));
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
valid.c
3+
--trace
4+
Passing problem to incremental SMT2 solving
5+
line 16 assertion make_dynamic \|\| \!__CPROVER_DYNAMIC_OBJECT\(pointer\)\: SUCCESS
6+
VERIFICATION SUCCESSFUL
7+
^EXIT=0$
8+
^SIGNAL=0$
9+
--
10+
--

0 commit comments

Comments
 (0)