Skip to content

Commit

Permalink
Remove pointert default constructor
Browse files Browse the repository at this point in the history
This constructor catered the risk of dealing with uninitialised
object/offset pairs.
  • Loading branch information
tautschnig committed Dec 5, 2022
1 parent 6672791 commit 3302184
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
7 changes: 3 additions & 4 deletions src/cprover/bv_pointers_wide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,9 @@ exprt bv_pointers_widet::bv_get_rec(

constant_exprt result(bvrep, type);

pointer_logict::pointert pointer;
pointer.object =
numeric_cast_v<std::size_t>(binary2integer(value_addr, false));
pointer.offset = binary2integer(value_offset, true);
pointer_logict::pointert pointer{
numeric_cast_v<std::size_t>(binary2integer(value_addr, false)),
binary2integer(value_offset, true)};

return annotated_pointer_constant_exprt{
bvrep, pointer_logic.pointer_expr(pointer, pt)};
Expand Down
7 changes: 3 additions & 4 deletions src/solvers/flattening/bv_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,9 @@ exprt bv_pointerst::bv_get_rec(

constant_exprt result(bvrep, type);

pointer_logict::pointert pointer;
pointer.object =
numeric_cast_v<std::size_t>(binary2integer(value_addr, false));
pointer.offset=binary2integer(value_offset, true);
pointer_logict::pointert pointer{
numeric_cast_v<std::size_t>(binary2integer(value_addr, false)),
binary2integer(value_offset, true)};

return annotated_pointer_constant_exprt{
bvrep, pointer_logic.pointer_expr(pointer, pt)};
Expand Down
4 changes: 0 additions & 4 deletions src/solvers/flattening/pointer_logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class pointer_logict
{
mp_integer object, offset;

pointert()
{
}

pointert(mp_integer _obj, mp_integer _off)
: object(std::move(_obj)), offset(std::move(_off))
{
Expand Down
4 changes: 1 addition & 3 deletions src/solvers/smt2/smt2_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,7 @@ exprt smt2_convt::parse_rec(const irept &src, const typet &type)

// split into object and offset
mp_integer pow=power(2, width-config.bv_encoding.object_bits);
pointer_logict::pointert ptr;
ptr.object = numeric_cast_v<std::size_t>(v / pow);
ptr.offset=v%pow;
pointer_logict::pointert ptr{numeric_cast_v<std::size_t>(v / pow), v % pow};
return annotated_pointer_constant_exprt(
bv_expr.get_value(),
pointer_logic.pointer_expr(ptr, to_pointer_type(type)));
Expand Down

0 comments on commit 3302184

Please sign in to comment.