Skip to content

Commit cd1ec89

Browse files
authored
Merge pull request #6194 from TGWDB/issue6130-auto-array
Enable and use the automatic limit for array-as-uninterpreted-function (duplicated, fixes 6130)
2 parents 856a729 + 8659dac commit cd1ec89

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/solvers/flattening/boolbv.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,12 @@ bool boolbvt::is_unbounded_array(const typet &type) const
544544
if(unbounded_array==unbounded_arrayt::U_ALL)
545545
return true;
546546

547-
const exprt &size=to_array_type(type).size();
548-
549-
const auto s = numeric_cast<mp_integer>(size);
550-
if(!s.has_value())
547+
const std::size_t size = boolbv_width(type);
548+
if(size == 0)
551549
return true;
552550

553551
if(unbounded_array==unbounded_arrayt::U_AUTO)
554-
if(*s > MAX_FLATTENED_ARRAY_SIZE)
552+
if(size > MAX_FLATTENED_ARRAY_SIZE)
555553
return true;
556554

557555
return false;

src/solvers/flattening/boolbv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class boolbvt:public arrayst
4747
message_handlert &message_handler,
4848
bool get_array_constraints = false)
4949
: arrayst(_ns, _prop, message_handler, get_array_constraints),
50-
unbounded_array(unbounded_arrayt::U_NONE),
50+
unbounded_array(unbounded_arrayt::U_AUTO),
5151
bv_width(_ns),
5252
bv_utils(_prop),
5353
functions(*this),

src/solvers/flattening/boolbv_width.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include <util/arith_tools.h>
1414
#include <util/c_types.h>
15-
#include <util/exception_utils.h>
1615
#include <util/invariant.h>
1716
#include <util/namespace.h>
1817
#include <util/std_types.h>
@@ -138,7 +137,6 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
138137
mp_integer total = *array_size * sub_width;
139138
if(total>(1<<30)) // realistic limit
140139
throw analysis_exceptiont("array too large for flattening");
141-
142140
if(total < 0)
143141
entry.total_width = 0;
144142
else
@@ -155,8 +153,10 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
155153
mp_integer total = vector_size * sub_width;
156154
if(total > (1 << 30)) // realistic limit
157155
throw analysis_exceptiont("vector too large for flattening");
158-
159-
entry.total_width = numeric_cast_v<std::size_t>(vector_size * sub_width);
156+
if(total < 0)
157+
entry.total_width = 0;
158+
else
159+
entry.total_width = numeric_cast_v<std::size_t>(vector_size * sub_width);
160160
}
161161
else if(type_id==ID_complex)
162162
{

0 commit comments

Comments
 (0)