Skip to content

Commit 006d998

Browse files
Rename size to L2 in field_sensitivity::apply
This is to allow constant propagation to take place and know whether the size is actually constant, which can allow field sensitivity to apply.
1 parent f7eac60 commit 006d998

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/goto-symex/field_sensitivity.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,21 @@ exprt field_sensitivityt::apply(
9797
// SSA expression
9898
ssa_exprt tmp = to_ssa_expr(index.array());
9999
bool was_l2 = !tmp.get_level_2().empty();
100-
101-
exprt array_size_expr = to_array_type(l2_array.get().type()).size();
102-
if(array_size_expr.is_nil() && index.array().id() == ID_symbol)
100+
exprt l2_size =
101+
state.rename(to_array_type(index.array().type()).size(), ns).get();
102+
if(l2_size.is_nil() && index.array().id() == ID_symbol)
103103
{
104104
// In case the array type was incomplete, attempt to retrieve it from
105105
// the symbol table.
106106
const symbolt *array_from_symbol_table = ns.get_symbol_table().lookup(
107107
to_symbol_expr(index.array()).get_identifier());
108108
if(array_from_symbol_table != nullptr)
109-
array_size_expr = to_array_type(array_from_symbol_table->type).size();
109+
l2_size = to_array_type(array_from_symbol_table->type).size();
110110
}
111111

112112
if(
113-
array_size_expr.id() == ID_constant &&
114-
numeric_cast_v<mp_integer>(to_constant_expr(array_size_expr)) <=
113+
l2_size.id() == ID_constant &&
114+
numeric_cast_v<mp_integer>(to_constant_expr(l2_size)) <=
115115
max_field_sensitive_array_size &&
116116
index.id() == ID_constant)
117117
{

0 commit comments

Comments
 (0)