Skip to content

Commit 89ca306

Browse files
Merge pull request #6781 from thomasspriggs/tas/smt_address_of
Add support for null pointer and address of expression conversion in incremental SMT2 backend.
2 parents 318ab18 + 41629be commit 89ca306

12 files changed

+969
-212
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <assert.h>
2+
#include <inttypes.h>
3+
#include <stdbool.h>
4+
#include <stddef.h>
5+
6+
int main()
7+
{
8+
int notdet_int;
9+
int *ptr;
10+
bool notdet_bool;
11+
if(notdet_bool)
12+
{
13+
ptr = &notdet_int;
14+
assert(((uint64_t)ptr) > 1);
15+
}
16+
else
17+
{
18+
ptr = NULL;
19+
}
20+
assert(((uint64_t)ptr) != 0);
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CORE
2+
null_pointer.c
3+
--trace
4+
Passing problem to incremental SMT2 solving
5+
line 14 assertion \(\(uint64_t\)ptr\) > 1: SUCCESS
6+
line 20 assertion \(\(uint64_t\)ptr\) != 0: FAILURE
7+
notdet_bool=FALSE \(0+\)
8+
^EXIT=10$
9+
^SIGNAL=0$
10+
--
11+
notdet_bool=TRUE
12+
--
13+
Tests for null related functionality.
14+
* Assignment of the value NULL to a pointer.
15+
* Comparison of NULL pointer value against 0.
16+
* Check that the address of a non-null pointer is not an offset into the NULL
17+
object.

src/solvers/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ SRC = $(BOOLEFORCE_SRC) \
195195
smt2/smt2irep.cpp \
196196
smt2_incremental/construct_value_expr_from_smt.cpp \
197197
smt2_incremental/convert_expr_to_smt.cpp \
198+
smt2_incremental/object_tracking.cpp \
198199
smt2_incremental/smt_bit_vector_theory.cpp \
199200
smt2_incremental/smt_commands.cpp \
200201
smt2_incremental/smt_core_theory.cpp \

0 commit comments

Comments
 (0)