Skip to content

Commit cbc48a8

Browse files
author
Daniel Kroening
committed
implement output for incomplete gotos
While these instructions only exist temporarily, it may still be useful to look at goto programs that contain them for debugging purposes.
1 parent c67ce88 commit cbc48a8

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/goto-programs/goto_program.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ std::ostream &goto_programt::output_instruction(
7474
break;
7575

7676
case GOTO:
77+
case INCOMPLETE_GOTO:
7778
if(!instruction.get_condition().is_true())
7879
{
7980
out << "IF " << from_expr(ns, identifier, instruction.get_condition())
@@ -82,14 +83,20 @@ std::ostream &goto_programt::output_instruction(
8283

8384
out << "GOTO ";
8485

85-
for(instructiont::targetst::const_iterator
86-
gt_it=instruction.targets.begin();
87-
gt_it!=instruction.targets.end();
88-
gt_it++)
86+
if(instruction.is_incomplete_goto())
8987
{
90-
if(gt_it!=instruction.targets.begin())
91-
out << ", ";
92-
out << (*gt_it)->target_number;
88+
out << "(incomplete)";
89+
}
90+
else
91+
{
92+
for(auto gt_it = instruction.targets.begin();
93+
gt_it != instruction.targets.end();
94+
gt_it++)
95+
{
96+
if(gt_it != instruction.targets.begin())
97+
out << ", ";
98+
out << (*gt_it)->target_number;
99+
}
93100
}
94101

95102
out << '\n';
@@ -214,9 +221,6 @@ std::ostream &goto_programt::output_instruction(
214221
case END_THREAD:
215222
out << "END THREAD" << '\n';
216223
break;
217-
218-
case INCOMPLETE_GOTO:
219-
UNREACHABLE;
220224
}
221225

222226
return out;

0 commit comments

Comments
 (0)