@@ -214,6 +214,7 @@ bool is_goto_binary(const std::string &filename)
214
214
215
215
static void rename_symbols_in_function (
216
216
goto_functionst::goto_functiont &function,
217
+ irep_idt &new_function_name,
217
218
const rename_symbolt &rename_symbol)
218
219
{
219
220
goto_programt &program=function.body ;
@@ -223,6 +224,9 @@ static void rename_symbols_in_function(
223
224
{
224
225
rename_symbol (iit->code );
225
226
rename_symbol (iit->guard );
227
+ // we need to update the instruction's function field as
228
+ // well, with the new symbol for the function
229
+ iit->function =new_function_name;
226
230
}
227
231
}
228
232
@@ -256,7 +260,7 @@ static bool link_functions(
256
260
257
261
if (dest_f_it==dest_functions.function_map .end ()) // not there yet
258
262
{
259
- rename_symbols_in_function (src_it->second , rename_symbol);
263
+ rename_symbols_in_function (src_it->second , final_id, rename_symbol);
260
264
261
265
goto_functionst::goto_functiont &in_dest_symbol_table=
262
266
dest_functions.function_map [final_id];
@@ -275,7 +279,7 @@ static bool link_functions(
275
279
weak_symbols.find (final_id)!=weak_symbols.end ())
276
280
{
277
281
// the one with body wins!
278
- rename_symbols_in_function (src_func, rename_symbol);
282
+ rename_symbols_in_function (src_func, final_id, rename_symbol);
279
283
280
284
in_dest_symbol_table.body .swap (src_func.body );
281
285
in_dest_symbol_table.type =src_func.type ;
@@ -323,7 +327,10 @@ static bool link_functions(
323
327
324
328
if (!macro_application.expr_map .empty ())
325
329
Forall_goto_functions (dest_it, dest_functions)
326
- rename_symbols_in_function (dest_it->second , macro_application);
330
+ {
331
+ irep_idt final_id=dest_it->first ;
332
+ rename_symbols_in_function (dest_it->second , final_id, macro_application);
333
+ }
327
334
328
335
if (!object_type_updates.expr_map .empty ())
329
336
{
0 commit comments