@@ -16,6 +16,8 @@ Date: July 2021
16
16
#include < ansi-c/ansi_c_language.h>
17
17
#include < ansi-c/expr2c.h>
18
18
19
+ #include < goto-programs/goto_convert_functions.h>
20
+
19
21
#include < linking/static_lifetime_init.h>
20
22
21
23
#include < util/config.h>
@@ -188,21 +190,18 @@ void is_fresh_baset::add_declarations(const std::string &decl_string)
188
190
}
189
191
}
190
192
191
- // We have to set the global memory map array to
192
- // all zeros for this to work properly
193
- const array_typet ty =
194
- to_array_type (tmp_symbol_table.lookup_ref (memmap_name).type );
195
- constant_exprt initial_value (irep_idt (dstringt (" 0" )), ty.subtype ());
196
- array_of_exprt memmap_init (initial_value, ty);
197
- goto_programt::instructiont a =
198
- goto_programt::make_assignment (symbol_exprt (memmap_name, ty), memmap_init);
199
-
200
- // insert the assignment into the initialize function.
201
- auto called_func =
202
- parent.get_goto_functions ().function_map .find (INITIALIZE_FUNCTION);
203
- goto_programt &body = called_func->second .body ;
204
- auto target = body.get_end_function ();
205
- body.insert_before (target, a);
193
+ if (parent.get_goto_functions ().function_map .erase (INITIALIZE_FUNCTION) != 0 )
194
+ {
195
+ static_lifetime_init (
196
+ parent.get_symbol_table (),
197
+ parent.get_symbol_table ().lookup_ref (INITIALIZE_FUNCTION).location );
198
+ goto_convert (
199
+ INITIALIZE_FUNCTION,
200
+ parent.get_symbol_table (),
201
+ parent.get_goto_functions (),
202
+ log .get_message_handler ());
203
+ parent.get_goto_functions ().update ();
204
+ }
206
205
}
207
206
208
207
void is_fresh_baset::update_fn_call (
0 commit comments