Skip to content

Commit 64ab723

Browse files
author
thk123
committed
Corrected simplify lhs in ai_domain_baset
The boolean flag was the wrong way round for ai_simplify_lhs - this corrects this.
1 parent 13a7538 commit 64ab723

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/analyses/ai.cpp

+13-9
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,33 @@ bool ai_domain_baset::ai_simplify_lhs(
5757
if(condition.id()==ID_index)
5858
{
5959
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)
6262
condition=simplify_expr(ie, ns);
6363

64-
return !changed;
64+
return no_simplification;
6565
}
6666
else if(condition.id()==ID_dereference)
6767
{
6868
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)
7171
condition=simplify_expr(de, ns); // So *(&x) -> x
7272

73-
return !changed;
73+
return no_simplification;
7474
}
7575
else if(condition.id()==ID_member)
7676
{
7777
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)
8084
condition=simplify_expr(me, ns);
8185

82-
return !changed;
86+
return no_simplification;
8387
}
8488
else
8589
return true;

0 commit comments

Comments
 (0)