@@ -242,22 +242,16 @@ bvt boolbvt::convert_array_comprehension(const array_comprehension_exprt &expr)
242242{
243243 std::size_t width=boolbv_width (expr.type ());
244244
245- if (width==0 )
246- return conversion_failed (expr);
247-
248245 const exprt &array_size = expr.type ().size ();
249246
250- const auto size = numeric_cast<mp_integer>(array_size);
251-
252- if (!size.has_value ())
253- return conversion_failed (expr);
247+ const auto size = numeric_cast_v<mp_integer>(to_constant_expr (array_size));
254248
255249 typet counter_type = expr.arg ().type ();
256250
257251 bvt bv;
258252 bv.resize (width);
259253
260- for (mp_integer i = 0 ; i < * size; ++i)
254+ for (mp_integer i = 0 ; i < size; ++i)
261255 {
262256 exprt counter=from_integer (i, counter_type);
263257
@@ -266,7 +260,7 @@ bvt boolbvt::convert_array_comprehension(const array_comprehension_exprt &expr)
266260 const bvt &tmp = convert_bv (body);
267261
268262 INVARIANT (
269- * size * tmp.size () == width,
263+ size * tmp.size () == width,
270264 " total bitvector width shall equal the number of operands times the size "
271265 " per operand" );
272266
@@ -521,12 +515,12 @@ bool boolbvt::is_unbounded_array(const typet &type) const
521515 if (unbounded_array==unbounded_arrayt::U_ALL)
522516 return true ;
523517
524- const std:: size_t size = boolbv_width (type);
525- if (size == 0 )
518+ const auto &size_opt = bv_width. get_width_opt (type);
519+ if (!size_opt. has_value () )
526520 return true ;
527521
528522 if (unbounded_array==unbounded_arrayt::U_AUTO)
529- if (size > MAX_FLATTENED_ARRAY_SIZE)
523+ if (*size_opt > MAX_FLATTENED_ARRAY_SIZE)
530524 return true ;
531525
532526 return false ;
0 commit comments