@@ -84,9 +84,9 @@ exprt field_sensitivityt::apply(
8484 member.struct_op () = tmp.get_original_expr ();
8585 tmp.set_expression (member);
8686 if (was_l2)
87- return state.rename (std::move (tmp), ns).get ();
87+ return apply (ns, state, state .rename (std::move (tmp), ns).get (), write );
8888 else
89- return std::move (tmp);
89+ return apply (ns, state, std::move (tmp), write );
9090 }
9191 }
9292 else if (
@@ -116,9 +116,12 @@ exprt field_sensitivityt::apply(
116116 tmp.type () = be.type ();
117117 tmp.set_expression (*recursive_member);
118118 if (was_l2)
119- return state.rename (std::move (tmp), ns).get ();
119+ {
120+ return apply (
121+ ns, state, state.rename (std::move (tmp), ns).get (), write);
122+ }
120123 else
121- return std::move (tmp);
124+ return apply (ns, state, std::move (tmp), write );
122125 }
123126 }
124127 }
@@ -171,9 +174,12 @@ exprt field_sensitivityt::apply(
171174 index.index () = l2_index.get ();
172175 tmp.set_expression (index);
173176 if (was_l2)
174- return state.rename (std::move (tmp), ns).get ();
177+ {
178+ return apply (
179+ ns, state, state.rename (std::move (tmp), ns).get (), write);
180+ }
175181 else
176- return std::move (tmp);
182+ return apply (ns, state, std::move (tmp), write );
177183 }
178184 else if (!write)
179185 {
@@ -293,6 +299,14 @@ void field_sensitivityt::field_assignments(
293299 {
294300 field_assignments_rec (
295301 ns, state, lhs_fs, rhs, target, allow_pointer_unsoundness);
302+ // Erase the composite symbol from our working state. Note that we need to
303+ // have it in the propagation table and the value set while doing the field
304+ // assignments, thus we cannot skip putting it in there above.
305+ if (is_divisible (lhs, true ))
306+ {
307+ state.propagation .erase_if_exists (lhs.get_identifier ());
308+ state.value_set .erase_symbol (lhs, ns);
309+ }
296310 }
297311}
298312
@@ -316,15 +330,11 @@ void field_sensitivityt::field_assignments_rec(
316330{
317331 if (is_ssa_expr (lhs_fs))
318332 {
319- const ssa_exprt ssa_lhs = state
320- .assignment (
321- to_ssa_expr (lhs_fs),
322- ssa_rhs,
323- ns,
324- true ,
325- true ,
326- allow_pointer_unsoundness)
327- .get ();
333+ const ssa_exprt &l1_lhs = to_ssa_expr (lhs_fs);
334+ const ssa_exprt ssa_lhs =
335+ state
336+ .assignment (l1_lhs, ssa_rhs, ns, true , true , allow_pointer_unsoundness)
337+ .get ();
328338
329339 // do the assignment
330340 target.assignment (
@@ -335,6 +345,14 @@ void field_sensitivityt::field_assignments_rec(
335345 ssa_rhs,
336346 state.source ,
337347 symex_targett::assignment_typet::STATE);
348+ // Erase the composite symbol from our working state. Note that we need to
349+ // have it in the propagation table and the value set while doing the field
350+ // assignments, thus we cannot skip putting it in there above.
351+ if (is_divisible (l1_lhs, true ))
352+ {
353+ state.propagation .erase_if_exists (l1_lhs.get_identifier ());
354+ state.value_set .erase_symbol (l1_lhs, ns);
355+ }
338356 }
339357 else if (
340358 ssa_rhs.type ().id () == ID_struct || ssa_rhs.type ().id () == ID_struct_tag)
0 commit comments