File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ void function_call_harness_generatort::implt::generate_nondet_globals(
281281 for (const auto &symbol_table_entry : *symbol_table)
282282 {
283283 const auto &symbol = symbol_table_entry.second ;
284- if (recursive_initialization-> is_initialization_allowed (symbol))
284+ if (recursive_initializationt:: is_initialization_allowed (symbol))
285285 {
286286 globals.push_back (symbol.symbol_expr ());
287287 }
Original file line number Diff line number Diff line change @@ -248,9 +248,7 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals(
248248 for (const auto &pair : goto_model.symbol_table )
249249 {
250250 const auto &global_symbol = pair.second ;
251- if (
252- global_symbol.is_static_lifetime && global_symbol.is_lvalue &&
253- global_symbol.type .id () != ID_code)
251+ if (recursive_initializationt::is_initialization_allowed (global_symbol))
254252 {
255253 auto symeexr = global_symbol.symbol_expr ();
256254 if (symeexr.type () == global_symbol.value .type ())
@@ -272,7 +270,8 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals(
272270 ? fresh_symbol_copy (snapshot_symbol, symbol_table)
273271 : snapshot_symbol;
274272
275- if (!fresh_or_snapshot_symbol.is_static_lifetime )
273+ if (!recursive_initializationt::is_initialization_allowed (
274+ fresh_or_snapshot_symbol))
276275 continue ;
277276
278277 if (variables_to_havoc.count (fresh_or_snapshot_symbol.base_name ) == 0 )
Original file line number Diff line number Diff line change @@ -103,12 +103,14 @@ class recursive_initializationt
103103 // / \return the symbol expression for the `free` function
104104 symbol_exprt get_free_function ();
105105
106- bool is_initialization_allowed (const symbolt &symbol)
106+ static bool is_initialization_allowed (const symbolt &symbol)
107107 {
108+ auto const symbol_name = id2string (symbol.name );
108109 return (
109110 symbol.is_static_lifetime && symbol.is_lvalue &&
110- symbol.type .id () != ID_code &&
111- !has_prefix (id2string (symbol.name ), CPROVER_PREFIX));
111+ !symbol.type .get_bool (ID_C_constant) && symbol.type .id () != ID_code &&
112+ !has_prefix (symbol_name, CPROVER_PREFIX) &&
113+ !has_prefix (symbol_name, GOTO_HARNESS_PREFIX));
112114 }
113115
114116 bool needs_freeing (const exprt &expr) const ;
You can’t perform that action at this time.
0 commit comments