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"
@@ -27,6 +28,19 @@ void goto_symext::symex_assign_rec(
27
28
code_assignt deref_code=code;
28
29
29
30
clean_expr (deref_code.lhs (), state, true );
31
+ // make the structure of the lhs as simple as possible to avoid,
32
+ // e.g., (b ? s1 : s2).member=X resulting in
33
+ // (b ? s1 : s2)=(b ? s1 : s2) with member:=X and then
34
+ // s1=b ? ((b ? s1 : s2) with member:=X) : s1
35
+ // when all we need is
36
+ // s1=s1 with member:=X [and guard b]
37
+ // s2=s2 with member:=X [and guard !b]
38
+ do_simplify (deref_code.lhs ());
39
+ // make sure simplify has not re-introduced any dereferencing that
40
+ // had previously been cleaned away
41
+ CHECK_RETURN (
42
+ !has_subexpr (deref_code.lhs (), ID_dereference),
43
+ " simplify re-introduced dereferencing" );
30
44
clean_expr (deref_code.rhs (), state, false );
31
45
32
46
symex_assign (state, deref_code);
0 commit comments