Skip to content

Commit c545369

Browse files
authored
Merge pull request #1663 from smowton/smowton/fix/guarded_gotos
Ensure guarded_gotos is cleared after converting each function
2 parents a2e2f74 + 2b835c6 commit c545369

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/goto-programs/goto_convert.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ void goto_convertt::finish_guarded_gotos(goto_programt &dest)
290290
for(auto it=gg.ifiter, itend=gg.gotoiter; it!=itend; ++it)
291291
it->make_skip();
292292
}
293+
294+
// Must clear this, as future functions may be converted
295+
// using the same instance of goto_convertt, typically via
296+
// goto_convert_functions.
297+
298+
guarded_gotos.clear();
293299
}
294300

295301
void goto_convertt::goto_convert(const codet &code, goto_programt &dest)
@@ -301,6 +307,9 @@ void goto_convertt::goto_convert_rec(
301307
const codet &code,
302308
goto_programt &dest)
303309
{
310+
// Check that guarded_gotos was cleared after any previous use of this
311+
// converter instance:
312+
PRECONDITION(guarded_gotos.empty());
304313
convert(code, dest);
305314

306315
finish_gotos(dest);

0 commit comments

Comments
 (0)