File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
regression/goto-analyzer/label Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ int main ()
2+ {
3+ goto ERROR ;
4+
5+ return 0 ;
6+ ERROR :
7+ return 1 ;
8+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --show-goto-functions --error-label ERROR
4+ Labels: ERROR$
5+ ASSIGN main#return_value := 1$
6+ ^EXIT=0$
7+ ^SIGNAL=0$
8+ --
9+ ^warning: ignoring
10+ --
11+ This test ensures that removal of return values (confirmed by the existence of
12+ the ASSIGN instruction) preserves labels attached to the return statement.
Original file line number Diff line number Diff line change @@ -128,8 +128,10 @@ void remove_returnst::replace_returns(
128128 code_assignt assignment (*return_symbol, instruction.return_value ());
129129
130130 // now turn the `return' into `assignment'
131+ auto labels = std::move (instruction.labels );
131132 instruction = goto_programt::make_assignment (
132133 assignment, instruction.source_location ());
134+ instruction.labels = std::move (labels);
133135 }
134136 else
135137 instruction.turn_into_skip ();
You can’t perform that action at this time.
0 commit comments