Skip to content

Add support for null pointer and address of expression conversion in incremental SMT2 backend. #6781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions regression/cbmc-incr-smt2/pointers/null_pointer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>

int main()
{
int notdet_int;
int *ptr;
bool notdet_bool;
if(notdet_bool)
{
ptr = &notdet_int;
assert(((uint64_t)ptr) > 1);
}
else
{
ptr = NULL;
}
assert(((uint64_t)ptr) != 0);
}
17 changes: 17 additions & 0 deletions regression/cbmc-incr-smt2/pointers/null_pointer.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CORE
null_pointer.c
--trace
Passing problem to incremental SMT2 solving
line 14 assertion \(\(uint64_t\)ptr\) > 1: SUCCESS
line 20 assertion \(\(uint64_t\)ptr\) != 0: FAILURE
notdet_bool=FALSE \(0+\)
^EXIT=10$
^SIGNAL=0$
--
notdet_bool=TRUE
--
Tests for null related functionality.
* Assignment of the value NULL to a pointer.
* Comparison of NULL pointer value against 0.
* Check that the address of a non-null pointer is not an offset into the NULL
object.
1 change: 1 addition & 0 deletions src/solvers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ SRC = $(BOOLEFORCE_SRC) \
smt2/smt2irep.cpp \
smt2_incremental/construct_value_expr_from_smt.cpp \
smt2_incremental/convert_expr_to_smt.cpp \
smt2_incremental/object_tracking.cpp \
smt2_incremental/smt_bit_vector_theory.cpp \
smt2_incremental/smt_commands.cpp \
smt2_incremental/smt_core_theory.cpp \
Expand Down
Loading