Skip to content

Flattening of ID_nondet_symbol for unbounded arrays [blocks: #3619] #4016

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 1 commit into from
Feb 4, 2019
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
13 changes: 8 additions & 5 deletions src/solvers/flattening/arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ void arrayst::collect_arrays(const exprt &a)
else if(a.id()==ID_member)
{
DATA_INVARIANT(
to_member_expr(a).struct_op().id()==ID_symbol,
("unexpected array expression: member with `"+
a.op0().id_string()+"'").c_str());
to_member_expr(a).struct_op().id() == ID_symbol ||
to_member_expr(a).struct_op().id() == ID_nondet_symbol,
("unexpected array expression: member with `" + a.op0().id_string() + "'")
.c_str());
}
else if(a.id()==ID_constant ||
a.id()==ID_array ||
Expand Down Expand Up @@ -450,8 +451,10 @@ void arrayst::add_array_constraints(
expr.id()==ID_string_constant)
{
}
else if(expr.id()==ID_member &&
to_member_expr(expr).struct_op().id()==ID_symbol)
else if(
expr.id() == ID_member &&
(to_member_expr(expr).struct_op().id() == ID_symbol ||
to_member_expr(expr).struct_op().id() == ID_nondet_symbol))
{
}
else if(expr.id()==ID_byte_update_little_endian ||
Expand Down
5 changes: 2 additions & 3 deletions src/solvers/flattening/boolbv_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ bvt boolbvt::convert_index(const index_exprt &expr)

// record type if array is a symbol

if(array.id()==ID_symbol)
map.get_map_entry(
to_symbol_expr(array).get_identifier(), array_type);
if(array.id() == ID_symbol || array.id() == ID_nondet_symbol)
map.get_map_entry(array.get(ID_identifier), array_type);

// make sure we have the index in the cache
convert_bv(index);
Expand Down
9 changes: 6 additions & 3 deletions src/solvers/strings/string_refinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ static exprt substitute_array_access(
*if_expr, index_expr.index(), symbol_generator, left_propagate);

INVARIANT(
array.is_nil() || array.id() == ID_symbol,
array.is_nil() || array.id() == ID_symbol || array.id() == ID_nondet_symbol,
std::string(
"in case the array is unknown, it should be a symbol or nil, id: ") +
id2string(array.id()));
Expand Down Expand Up @@ -1700,7 +1700,9 @@ static void initial_index_set(
const exprt &s,
const exprt &i)
{
PRECONDITION(s.id() == ID_symbol || s.id() == ID_array || s.id() == ID_if);
PRECONDITION(
s.id() == ID_symbol || s.id() == ID_nondet_symbol || s.id() == ID_array ||
s.id() == ID_if);
if(s.id() == ID_array)
{
for(std::size_t j = 0; j < s.operands().size(); ++j)
Expand Down Expand Up @@ -2002,7 +2004,8 @@ exprt string_refinementt::get(const exprt &expr) const
}

INVARIANT(
array.is_nil() || array.id() == ID_symbol,
array.is_nil() || array.id() == ID_symbol ||
array.id() == ID_nondet_symbol,
std::string("apart from symbols, array valuations can be interpreted as "
"sparse arrays, id: ") +
id2string(array.id()));
Expand Down