Skip to content

Commit e307538

Browse files
committed
Enable and use the automatic limit for array-as-uninterpreted-function
This is a duplicate of PR diffblue#2108. This is here for alternative author management. Fixes diffblue#6130
1 parent f9be0eb commit e307538

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

src/solvers/flattening/boolbv.cpp

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

542-
const exprt &size=to_array_type(type).size();
543-
544-
const auto s = numeric_cast<mp_integer>(size);
545-
if(!s.has_value())
542+
const std::size_t size = boolbv_width(type);
543+
if(size == 0)
546544
return true;
547545

548546
if(unbounded_array==unbounded_arrayt::U_AUTO)
549-
if(*s > MAX_FLATTENED_ARRAY_SIZE)
547+
if(size > MAX_FLATTENED_ARRAY_SIZE)
550548
return true;
551549

552550
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: 1 addition & 11 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>
@@ -136,13 +135,7 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
136135
else
137136
{
138137
mp_integer total = *array_size * sub_width;
139-
if(total>(1<<30)) // realistic limit
140-
throw analysis_exceptiont("array too large for flattening");
141-
142-
if(total < 0)
143-
entry.total_width = 0;
144-
else
145-
entry.total_width = numeric_cast_v<std::size_t>(total);
138+
entry.total_width = numeric_cast_v<std::size_t>(total);
146139
}
147140
}
148141
else if(type_id==ID_vector)
@@ -153,9 +146,6 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
153146
const auto vector_size = numeric_cast_v<mp_integer>(vector_type.size());
154147

155148
mp_integer total = vector_size * sub_width;
156-
if(total > (1 << 30)) // realistic limit
157-
throw analysis_exceptiont("vector too large for flattening");
158-
159149
entry.total_width = numeric_cast_v<std::size_t>(vector_size * sub_width);
160150
}
161151
else if(type_id==ID_complex)

0 commit comments

Comments
 (0)