Skip to content

Commit b44589e

Browse files
Make disjuncts in instanceof removal independent of class loading
The disjuncts created by instanceof removal depended on the class loading order, causing goto-diff to think that there was a change in the classes.
1 parent 3afff86 commit b44589e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/goto-programs/remove_instanceof.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ std::size_t remove_instanceoft::lower_instanceof(
8787
std::vector<irep_idt> children=
8888
class_hierarchy.get_children_trans(target_name);
8989
children.push_back(target_name);
90+
// Sort alphabetically to make order of generated disjuncts
91+
// independent of class loading order
92+
std::sort(
93+
children.begin(),
94+
children.end(),
95+
[](const irep_idt &a, const irep_idt &b) { // NOLINT
96+
return a.compare(b) < 0;
97+
});
9098

9199
// Insert an instruction before the new check that assigns the clsid we're
92100
// checking for to a temporary, as GOTO program if-expressions should

0 commit comments

Comments
 (0)