@@ -70,10 +70,12 @@ exprt boolbvt::bv_get_rec(
7070 {
7171 if (type.id ()==ID_array)
7272 {
73+ const auto &array_type = to_array_type (type);
74+
7375 if (is_unbounded_array (type))
7476 return bv_get_unbounded_array (expr);
7577
76- const typet &subtype=type. subtype ();
78+ const typet &subtype = array_type. element_type ();
7779 std::size_t sub_width=boolbv_width (subtype);
7880
7981 if (sub_width!=0 )
@@ -86,7 +88,8 @@ exprt boolbvt::bv_get_rec(
8688 new_offset+=sub_width)
8789 {
8890 const index_exprt index{
89- expr, from_integer (new_offset / sub_width, index_type ())};
91+ expr,
92+ from_integer (new_offset / sub_width, array_type.index_type ())};
9093 op.push_back (bv_get_rec (index, bv, offset + new_offset, subtype));
9194 }
9295
@@ -96,7 +99,7 @@ exprt boolbvt::bv_get_rec(
9699 }
97100 else
98101 {
99- return array_exprt{{}, to_array_type (type) };
102+ return array_exprt{{}, array_type };
100103 }
101104 }
102105 else if (type.id ()==ID_struct_tag)
@@ -157,20 +160,22 @@ exprt boolbvt::bv_get_rec(
157160 }
158161 else if (type.id ()==ID_vector)
159162 {
160- const typet &subtype = type.subtype ();
161- std::size_t sub_width=boolbv_width (subtype);
163+ const auto &vector_type = to_vector_type (type);
164+ const typet &element_type = vector_type.element_type ();
165+ std::size_t element_width = boolbv_width (element_type);
162166
163- if (sub_width!= 0 && width%sub_width== 0 )
167+ if (element_width != 0 && width % element_width == 0 )
164168 {
165- std::size_t size= width/sub_width ;
166- vector_exprt value ({}, to_vector_type (type) );
169+ std::size_t size = width / element_width ;
170+ vector_exprt value ({}, vector_type );
167171 value.reserve_operands (size);
168172
169173 for (std::size_t i=0 ; i<size; i++)
170174 {
171- const index_exprt index{expr, from_integer (i, index_type ())};
175+ const index_exprt index{expr,
176+ from_integer (i, vector_type.index_type ())};
172177 value.operands ().push_back (
173- bv_get_rec (index, bv, i * sub_width, subtype ));
178+ bv_get_rec (index, bv, i * element_width, element_type ));
174179 }
175180
176181 return std::move (value);
0 commit comments