Skip to content

Commit 062bc0c

Browse files
committed
Support non-NULL pointer constants in the SMT back-end
We just treat them as bit vectors. Such constants arise when more constant propagation is enabled (via union field sensitivity) in the havoc_slice regression tests.
1 parent baef5a3 commit 062bc0c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

regression/cbmc/union13/no-arch.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--arch none --little-endian
44
(Starting CEGAR Loop|^Generated 1 VCC\(s\), 1 remaining after simplification$)

src/solvers/smt2/smt2_conv.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -3318,8 +3318,14 @@ void smt2_convt::convert_constant(const constant_exprt &expr)
33183318
<< ")";
33193319
}
33203320
else
3321-
UNEXPECTEDCASE(
3322-
"unknown pointer constant: " + id2string(expr.get_value()));
3321+
{
3322+
// just treat the pointer as a bit vector
3323+
const std::size_t width = boolbv_width(expr_type);
3324+
3325+
const mp_integer value = bvrep2integer(expr.get_value(), width, false);
3326+
3327+
out << "(_ bv" << value << " " << width << ")";
3328+
}
33233329
}
33243330
else if(expr_type.id()==ID_bool)
33253331
{

0 commit comments

Comments
 (0)