Skip to content

Commit 4442758

Browse files
fixup! Apply L2 renaming in field_sensitivityt::apply
1 parent c95160b commit 4442758

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/goto-symex/field_sensitivity.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,30 +94,30 @@ exprt field_sensitivityt::apply(
9494
ssa_exprt tmp = to_ssa_expr(index.array());
9595
auto l2_index = state.rename(index.index(), ns);
9696
l2_index.simplify(ns);
97-
auto l2_array = state.rename(index.array(), ns);
97+
exprt l2_size = state.rename(
98+
to_array_type(index.array().type()).size(), ns).get();
9899
bool was_l2 = !tmp.get_level_2().empty();
99100

100-
exprt array_size_expr = to_array_type(l2_array.get().type()).size();
101-
if(array_size_expr.is_nil() && index.array().id() == ID_symbol)
101+
if(l2_size.is_nil() && index.array().id() == ID_symbol)
102102
{
103103
// In case the array type was incomplete, attempt to retrieve it from
104104
// the symbol table.
105105
const symbolt *array_from_symbol_table = ns.get_symbol_table()
106106
.lookup(to_symbol_expr(index.array()).get_identifier());
107107
if(array_from_symbol_table != nullptr)
108-
array_size_expr = to_array_type(array_from_symbol_table->type).size();
108+
l2_size = to_array_type(array_from_symbol_table->type).size();
109109
}
110110

111111
if(
112-
array_size_expr.id() == ID_constant &&
113-
numeric_cast_v<mp_integer>(to_constant_expr(array_size_expr))
112+
l2_size.id() == ID_constant &&
113+
numeric_cast_v<mp_integer>(to_constant_expr(l2_size))
114114
<= max_field_sensitive_array_size )
115115
{
116116
if(l2_index.get().id() == ID_constant)
117117
{
118118
// place the entire index expression, not just the array operand, in an
119119
// SSA expression
120-
ssa_exprt ssa_array = to_ssa_expr(l2_array.get());
120+
ssa_exprt ssa_array = to_ssa_expr(index.array());
121121
ssa_array.remove_level_2();
122122
index.array() = ssa_array.get_original_expr();
123123
index.index() = l2_index.get();
@@ -131,7 +131,7 @@ exprt field_sensitivityt::apply(
131131
{
132132
// Expand the array and return `{array[0]; array[1]; ...}[index]`
133133
exprt expanded_array =
134-
get_fields(ns, state, to_ssa_expr(l2_array.get()));
134+
get_fields(ns, state, to_ssa_expr(index.array()));
135135
return index_exprt{std::move(expanded_array), l2_index.get()};
136136
}
137137
}

0 commit comments

Comments
 (0)