@@ -248,7 +248,8 @@ exprt allocate_dynamic_object(
248
248
// / \param symbol_table: symbol table
249
249
// / \param loc: location in the source
250
250
// / \param output_code: code block to which the necessary code is added
251
- void allocate_dynamic_object_with_decl (
251
+ // / \return the dynamic object created
252
+ exprt allocate_dynamic_object_with_decl (
252
253
const exprt &target_expr,
253
254
symbol_table_baset &symbol_table,
254
255
const source_locationt &loc,
@@ -258,7 +259,7 @@ void allocate_dynamic_object_with_decl(
258
259
code_blockt tmp_block;
259
260
const typet &allocate_type=target_expr.type ().subtype ();
260
261
// We will not use the malloc site and can safely ignore it
261
- ( void ) allocate_dynamic_object (
262
+ const exprt result = allocate_dynamic_object (
262
263
target_expr,
263
264
allocate_type,
264
265
symbol_table,
@@ -278,6 +279,7 @@ void allocate_dynamic_object_with_decl(
278
279
279
280
for (const exprt &code : tmp_block.operands ())
280
281
output_code.add (to_code (code));
282
+ return result;
281
283
}
282
284
283
285
// / Installs a new symbol in the symbol table, pushing the corresponding symbolt
@@ -701,11 +703,12 @@ static bool add_nondet_string_pointer_initialization(
701
703
if (!struct_type.has_component (" data" ) || !struct_type.has_component (" length" ))
702
704
return true ;
703
705
704
- allocate_dynamic_object_with_decl (expr, symbol_table, loc, code);
706
+ const exprt malloc_site =
707
+ allocate_dynamic_object_with_decl (expr, symbol_table, loc, code);
705
708
706
709
code.add (
707
710
initialize_nondet_string_struct (
708
- dereference_exprt (expr , struct_type),
711
+ dereference_exprt (malloc_site , struct_type),
709
712
max_nondet_string_length,
710
713
loc,
711
714
symbol_table,
0 commit comments