Skip to content

Re-enable array theory as default for array size above threshold #8468

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion regression/cbmc/array-bug-6230/main.c
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@

struct inner
{
uint32_t exts[32]; // 32 is the minimum to crash
// 32 is the minimum to crash as it will produce an array wider than 1000 bits
// (the default value of MAX_FLATTENED_ARRAY_SIZE)
uint32_t exts[32];
};

struct outer
2 changes: 1 addition & 1 deletion regression/cbmc/bounds_check1/test.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CORE thorough-smt-backend no-new-smt
main.c
--no-malloc-may-fail
--no-malloc-may-fail --arrays-uf-never
^EXIT=10$
^SIGNAL=0$
\[\(.*\)i2\]: FAILURE
2 changes: 1 addition & 1 deletion regression/cbmc/union/union_large_array.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CORE thorough-smt-backend no-new-smt
union_large_array.c

--arrays-uf-never
^EXIT=10$
^SIGNAL=0$
^\[main\.assertion\.1\] line \d+ should fail: FAILURE$
27 changes: 18 additions & 9 deletions src/solvers/flattening/arrays.cpp
Original file line number Diff line number Diff line change
@@ -196,12 +196,24 @@
}
else if(a.id()==ID_member)
{
const auto &struct_op = to_member_expr(a).struct_op();
const exprt *struct_op_ptr = &to_member_expr(a).struct_op();
while(struct_op_ptr->id() == ID_member)
struct_op_ptr = &to_member_expr(*struct_op_ptr).struct_op();

DATA_INVARIANT(
struct_op.id() == ID_symbol || struct_op.id() == ID_nondet_symbol,
"unexpected array expression: member with '" + struct_op.id_string() +
"'");
if(struct_op_ptr->id() == ID_index)
{
const auto &array_op = to_index_expr(*struct_op_ptr).array();
arrays.make_union(a, array_op);
collect_arrays(array_op);

Check warning on line 207 in src/solvers/flattening/arrays.cpp

Codecov / codecov/patch

src/solvers/flattening/arrays.cpp#L205-L207

Added lines #L205 - L207 were not covered by tests
}
else

Check warning on line 209 in src/solvers/flattening/arrays.cpp

Codecov / codecov/patch

src/solvers/flattening/arrays.cpp#L209

Added line #L209 was not covered by tests
{
DATA_INVARIANT(
struct_op_ptr->id() == ID_struct || struct_op_ptr->id() == ID_symbol ||
struct_op_ptr->id() == ID_nondet_symbol,

Check warning on line 213 in src/solvers/flattening/arrays.cpp

Codecov / codecov/patch

src/solvers/flattening/arrays.cpp#L212-L213

Added lines #L212 - L213 were not covered by tests
"unexpected array expression: member with '" +
struct_op_ptr->id_string() + "'");

Check warning on line 215 in src/solvers/flattening/arrays.cpp

Codecov / codecov/patch

src/solvers/flattening/arrays.cpp#L215

Added line #L215 was not covered by tests
}
}
else if(a.is_constant() || a.id() == ID_array || a.id() == ID_string_constant)
{
@@ -497,10 +509,7 @@
expr.id() == ID_string_constant)
{
}
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_member)
{
}
else if(expr.id()==ID_byte_update_little_endian ||
2 changes: 1 addition & 1 deletion src/solvers/flattening/boolbv.h
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ class boolbvt:public arrayst
message_handlert &message_handler,
bool get_array_constraints = false)
: arrayst(_ns, _prop, message_handler, get_array_constraints),
unbounded_array(unbounded_arrayt::U_NONE),
unbounded_array(unbounded_arrayt::U_AUTO),
bv_width(_ns),
bv_utils(_prop),
functions(*this),