Skip to content

Commit 32bf48e

Browse files
author
Daniel Kroening
authored
Merge pull request #2105 from tautschnig/determinise-test
Make test independent of string table entry ordering
2 parents 0f1482c + e1f4120 commit 32bf48e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

regression/cbmc-java/virtual7/test.desc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ test.class
33
--show-goto-functions --function test.main
44
^EXIT=0$
55
^SIGNAL=0$
6-
IF.*"java::C".*THEN GOTO
7-
IF.*"java::D".*THEN GOTO
6+
IF.*"java::B".*THEN GOTO
7+
IF.*"java::E".*THEN GOTO
88
IF.*"java::A".*THEN GOTO

src/goto-programs/remove_virtual_functions.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,15 @@ void remove_virtual_functionst::get_functions(
445445
has_prefix(
446446
id2string(b.symbol_expr.get_identifier()), "java::java.lang.Object"))
447447
return true;
448-
else if(a.symbol_expr.get_identifier() == b.symbol_expr.get_identifier())
449-
return a.class_id < b.class_id;
450448
else
451-
return a.symbol_expr.get_identifier() < b.symbol_expr.get_identifier();
449+
{
450+
int cmp = a.symbol_expr.get_identifier().compare(
451+
b.symbol_expr.get_identifier());
452+
if(cmp == 0)
453+
return a.class_id < b.class_id;
454+
else
455+
return cmp < 0;
456+
}
452457
});
453458
}
454459

0 commit comments

Comments
 (0)