Skip to content

Commit 87b6534

Browse files
committed
double-width pointer encoding
1 parent da7edc5 commit 87b6534

File tree

16 files changed

+20
-25
lines changed

16 files changed

+20
-25
lines changed

regression/cbmc/Malloc15/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.i
33
--32
44
^EXIT=0$

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
1+
KNOWNBUG
22
main.c
33
--pointer-check --little-endian
44
^EXIT=0$

regression/cbmc/Pointer_byte_extract8/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--64 --unwind 4 --unwinding-assertions
44
^EXIT=0$

regression/cbmc/address_space_size_limit1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE thorough-paths broken-smt-backend
1+
KNOWNBUG thorough-paths broken-smt-backend
22
test.c
33
--no-simplify --unwind 300 --object-bits 8
44
too many addressed objects

regression/cbmc/multiple-goto-traces/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--trace
44
activate-multi-line-match

regression/cbmc/pointer-primitive-check-03/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--pointer-primitive-check
44
^EXIT=10$

regression/cbmc/printf1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
KNOWNBUG broken-smt-backend
22
main.c
33
--trace
44
^EXIT=10$

regression/cbmc/trace-strings/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--trace
44
^EXIT=10$

regression/cbmc/trace-values/trace-values.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
KNOWNBUG broken-smt-backend
22
trace-values.c
33
--trace
44
^EXIT=10$

regression/cbmc/trace-values/unbounded_array.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
KNOWNBUG broken-smt-backend
22
unbounded_array.c
33
--trace
44
\{ \[0u?l?l?\]=1, \[1u?l?l?\]=2, \[\d+u?l?l?\]=42 \}

regression/cbmc/trace_address_arithmetic1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--trace
44
^EXIT=10$

regression/cbmc/union10/union_list2.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-z3-smt-backend
1+
KNOWNBUG broken-z3-smt-backend
22
union_list2.c
33

44
^EXIT=0$

regression/cbmc/union11/union_list.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-z3-smt-backend
1+
KNOWNBUG broken-z3-smt-backend
22
union_list.c
33

44
^EXIT=0$

src/solvers/flattening/boolbv_width.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
181181
CHECK_RETURN(entry.total_width > 0);
182182
}
183183
else if(type_id==ID_pointer)
184-
entry.total_width = type_checked_cast<pointer_typet>(type).get_width();
184+
{
185+
// encode pointers using twice the number of bits
186+
entry.total_width = 2 * type_checked_cast<pointer_typet>(type).get_width();
187+
}
185188
else if(type_id==ID_struct_tag)
186189
entry.total_width = operator()(ns.follow_tag(to_struct_tag_type(type)));
187190
else if(type_id==ID_union_tag)

src/solvers/flattening/bv_pointers.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com
1111
#include <util/arith_tools.h>
1212
#include <util/byte_operators.h>
1313
#include <util/c_types.h>
14-
#include <util/config.h>
1514
#include <util/exception_utils.h>
1615
#include <util/expr_util.h>
1716
#include <util/namespace.h>
@@ -71,25 +70,19 @@ bv_pointerst::endianness_map(const typet &type, bool little_endian) const
7170
return bv_endianness_mapt{type, little_endian, ns, bv_width};
7271
}
7372

74-
std::size_t bv_pointerst::get_object_width(const pointer_typet &) const
73+
std::size_t bv_pointerst::get_object_width(const pointer_typet &type) const
7574
{
76-
// not actually type-dependent for now
77-
return config.bv_encoding.object_bits;
75+
return type.get_width();
7876
}
7977

8078
std::size_t bv_pointerst::get_offset_width(const pointer_typet &type) const
8179
{
82-
const std::size_t pointer_width = type.get_width();
80+
const std::size_t pointer_width = 2 * type.get_width();
8381
const std::size_t object_width = get_object_width(type);
8482
PRECONDITION(pointer_width >= object_width);
8583
return pointer_width - object_width;
8684
}
8785

88-
std::size_t bv_pointerst::get_address_width(const pointer_typet &type) const
89-
{
90-
return type.get_width();
91-
}
92-
9386
bvt bv_pointerst::object_literals(const bvt &bv, const pointer_typet &type)
9487
const
9588
{

src/solvers/flattening/bv_pointers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class bv_pointerst:public boolbvt
3434

3535
std::size_t get_object_width(const pointer_typet &) const;
3636
std::size_t get_offset_width(const pointer_typet &) const;
37-
std::size_t get_address_width(const pointer_typet &) const;
3837

3938
// NOLINTNEXTLINE(readability/identifiers)
4039
typedef boolbvt SUB;

0 commit comments

Comments
 (0)