Skip to content

Commit 861fabd

Browse files
committed
Function pointer removal: ensure presence of source location
Return type fix-up tried to use the source location from the function-call code, which had just been constructed and necessarily lacked a source location. Instead, explicitly pass a source location.
1 parent bdb271a commit 861fabd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/goto-programs/remove_function_pointers.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ static void fix_argument_types(code_function_callt &function_call)
205205
static void fix_return_type(
206206
const irep_idt &in_function_id,
207207
code_function_callt &function_call,
208+
const source_locationt &source_location,
208209
symbol_tablet &symbol_table,
209210
goto_programt &dest)
210211
{
@@ -226,7 +227,7 @@ static void fix_return_type(
226227
code_type.return_type(),
227228
id2string(in_function_id),
228229
"tmp_return_val_" + id2string(function_symbol.base_name),
229-
function_call.source_location(),
230+
source_location,
230231
function_symbol.mode,
231232
symbol_table);
232233

@@ -239,7 +240,7 @@ static void fix_return_type(
239240
old_lhs,
240241
make_byte_extract(
241242
tmp_symbol_expr, from_integer(0, c_index_type()), old_lhs.type()),
242-
function_call.source_location())));
243+
source_location)));
243244
}
244245

245246
void remove_function_pointerst::remove_function_pointer(
@@ -407,7 +408,8 @@ void remove_function_pointer(
407408
fix_argument_types(new_call);
408409

409410
goto_programt tmp;
410-
fix_return_type(function_id, new_call, symbol_table, tmp);
411+
fix_return_type(
412+
function_id, new_call, target->source_location(), symbol_table, tmp);
411413

412414
auto call = new_code_calls.add(
413415
goto_programt::make_function_call(new_call, target->source_location()));

0 commit comments

Comments
 (0)