Skip to content

Commit 5ec592e

Browse files
committed
switch-case conversion: ensure case selection has source location
The expression operand may be lacking a source location (as was seen on larger projects). Restore a source location by using the one from the case statement.
1 parent b8de17a commit 5ec592e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/goto-programs/goto_convert.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ void goto_convertt::convert_switch_case(
382382

383383
exprt::operandst &case_op_dest=cases_entry->second->second;
384384
case_op_dest.push_back(code.case_op());
385+
if(case_op_dest.back().source_location().is_nil())
386+
case_op_dest.back().add_source_location() = code.source_location();
385387
}
386388
}
387389

0 commit comments

Comments
 (0)