@@ -57,29 +57,33 @@ bool ai_domain_baset::ai_simplify_lhs(
57
57
if (condition.id ()==ID_index)
58
58
{
59
59
index_exprt ie=to_index_expr (condition);
60
- bool changed =ai_simplify (ie.index (), ns);
61
- if (changed )
60
+ bool no_simplification =ai_simplify (ie.index (), ns);
61
+ if (!no_simplification )
62
62
condition=simplify_expr (ie, ns);
63
63
64
- return !changed ;
64
+ return no_simplification ;
65
65
}
66
66
else if (condition.id ()==ID_dereference)
67
67
{
68
68
dereference_exprt de=to_dereference_expr (condition);
69
- bool changed =ai_simplify (de.pointer (), ns);
70
- if (changed )
69
+ bool no_simplification =ai_simplify (de.pointer (), ns);
70
+ if (!no_simplification )
71
71
condition=simplify_expr (de, ns); // So *(&x) -> x
72
72
73
- return !changed ;
73
+ return no_simplification ;
74
74
}
75
75
else if (condition.id ()==ID_member)
76
76
{
77
77
member_exprt me=to_member_expr (condition);
78
- bool changed=ai_simplify_lhs (me.compound (), ns); // <-- lhs!
79
- if (changed)
78
+ // Since simplify_ai_lhs is required to return an addressable object
79
+ // (so remains a valid left hand side), to simplify
80
+ // `(something_simplifiable).b` we require that `something_simplifiable`
81
+ // must also be addressable
82
+ bool no_simplification=ai_simplify_lhs (me.compound (), ns);
83
+ if (!no_simplification)
80
84
condition=simplify_expr (me, ns);
81
85
82
- return !changed ;
86
+ return no_simplification ;
83
87
}
84
88
else
85
89
return true ;
0 commit comments