13
13
14
14
#include < util/byte_operators.h>
15
15
#include < util/cprover_prefix.h>
16
-
16
+ #include < util/expr_util.h>
17
+ #include < util/invariant.h>
17
18
#include < util/c_types.h>
18
19
19
20
#include " goto_symex_state.h"
@@ -28,6 +29,19 @@ void goto_symext::symex_assign(
28
29
exprt rhs=code.rhs ();
29
30
30
31
clean_expr (lhs, state, true );
32
+ // make the structure of the lhs as simple as possible to avoid,
33
+ // e.g., (b ? s1 : s2).member=X resulting in
34
+ // (b ? s1 : s2)=(b ? s1 : s2) with member:=X and then
35
+ // s1=b ? ((b ? s1 : s2) with member:=X) : s1
36
+ // when all we need is
37
+ // s1=s1 with member:=X [and guard b]
38
+ // s2=s2 with member:=X [and guard !b]
39
+ do_simplify (lhs);
40
+ // make sure simplify has not re-introduced any dereferencing that
41
+ // had previously been cleaned away
42
+ INVARIANT (
43
+ !has_subexpr (lhs, ID_dereference),
44
+ " simplify re-introduced dereferencing" );
31
45
clean_expr (rhs, state, false );
32
46
33
47
if (rhs.id ()==ID_side_effect)
0 commit comments