File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -61,16 +61,18 @@ bvt boolbvt::convert_index(const index_exprt &expr)
61
61
}
62
62
63
63
// Must have a finite size
64
- mp_integer array_size;
65
- if (to_integer (array_type.size (), array_size))
66
- throw " failed to convert array size" ;
67
-
68
- // see if the index address is constant
69
- // many of these are compacted by simplify_expr
70
- // but variable location writes will block this
71
- mp_integer index_value;
72
- if (!to_integer (index , index_value))
73
- return convert_index (array, index_value);
64
+ mp_integer array_size = numeric_cast_v<mp_integer>(array_type.size ());
65
+
66
+ {
67
+ // see if the index address is constant
68
+ // many of these are compacted by simplify_expr
69
+ // but variable location writes will block this
70
+ auto maybe_index_value = numeric_cast<mp_integer>(index );
71
+ if (maybe_index_value.has_value ())
72
+ {
73
+ return convert_index (array, maybe_index_value.value ());
74
+ }
75
+ }
74
76
75
77
// Special case : arrays of one thing (useful for constants)
76
78
// TODO : merge with ACTUAL_ARRAY_HACK so that ranges of the same
You can’t perform that action at this time.
0 commit comments