Skip to content

Commit 4383f48

Browse files
committed
Enable and use the automatic limit for array-as-uninterpreted-function
Previously, the command line permitted setting uninterpreted functions to "never" or "always", where "never" actually was the default. The "automatic" mode could not be enabled in any way. Furthermore the limit should apply across all dimensions of an array, not just the top-level size. Fixes: #2018
1 parent abd2628 commit 4383f48

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/solvers/flattening/boolbv.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -631,14 +631,12 @@ bool boolbvt::is_unbounded_array(const typet &type) const
631631
if(unbounded_array==unbounded_arrayt::U_ALL)
632632
return true;
633633

634-
const exprt &size=to_array_type(type).size();
635-
636-
const auto s = numeric_cast<mp_integer>(size);
637-
if(!s.has_value())
634+
const std::size_t size = boolbv_width(type);
635+
if(size == 0)
638636
return true;
639637

640638
if(unbounded_array==unbounded_arrayt::U_AUTO)
641-
if(*s > MAX_FLATTENED_ARRAY_SIZE)
639+
if(size > MAX_FLATTENED_ARRAY_SIZE)
642640
return true;
643641

644642
return false;

src/solvers/flattening/boolbv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class boolbvt:public arrayst
3939
propt &_prop,
4040
message_handlert &message_handler)
4141
: arrayst(_ns, _prop, message_handler),
42-
unbounded_array(unbounded_arrayt::U_NONE),
42+
unbounded_array(unbounded_arrayt::U_AUTO),
4343
boolbv_width(_ns),
4444
bv_utils(_prop),
4545
functions(*this),

src/solvers/flattening/boolbv_width.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening, [email protected]
1111
#include <algorithm>
1212

1313
#include <util/arith_tools.h>
14-
#include <util/exception_utils.h>
1514
#include <util/invariant.h>
1615
#include <util/std_types.h>
1716

@@ -138,9 +137,6 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
138137
else
139138
{
140139
mp_integer total = *array_size * sub_width;
141-
if(total>(1<<30)) // realistic limit
142-
throw analysis_exceptiont("array too large for flattening");
143-
144140
entry.total_width = numeric_cast_v<std::size_t>(total);
145141
}
146142
}
@@ -152,9 +148,6 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
152148
const auto vector_size = numeric_cast_v<mp_integer>(vector_type.size());
153149

154150
mp_integer total = vector_size * sub_width;
155-
if(total > (1 << 30)) // realistic limit
156-
throw analysis_exceptiont("vector too large for flattening");
157-
158151
entry.total_width = numeric_cast_v<std::size_t>(vector_size * sub_width);
159152
}
160153
else if(type_id==ID_complex)

0 commit comments

Comments
 (0)