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(
281
281
for (const auto &symbol_table_entry : *symbol_table)
282
282
{
283
283
const auto &symbol = symbol_table_entry.second ;
284
- if (recursive_initialization-> is_initialization_allowed (symbol))
284
+ if (recursive_initializationt:: is_initialization_allowed (symbol))
285
285
{
286
286
globals.push_back (symbol.symbol_expr ());
287
287
}
Original file line number Diff line number Diff line change @@ -248,9 +248,7 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals(
248
248
for (const auto &pair : goto_model.symbol_table )
249
249
{
250
250
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))
254
252
{
255
253
auto symeexr = global_symbol.symbol_expr ();
256
254
if (symeexr.type () == global_symbol.value .type ())
@@ -272,7 +270,8 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals(
272
270
? fresh_symbol_copy (snapshot_symbol, symbol_table)
273
271
: snapshot_symbol;
274
272
275
- if (!fresh_or_snapshot_symbol.is_static_lifetime )
273
+ if (!recursive_initializationt::is_initialization_allowed (
274
+ fresh_or_snapshot_symbol))
276
275
continue ;
277
276
278
277
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
103
103
// / \return the symbol expression for the `free` function
104
104
symbol_exprt get_free_function ();
105
105
106
- bool is_initialization_allowed (const symbolt &symbol)
106
+ static bool is_initialization_allowed (const symbolt &symbol)
107
107
{
108
+ auto const symbol_name = id2string (symbol.name );
108
109
return (
109
110
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));
112
114
}
113
115
114
116
bool needs_freeing (const exprt &expr) const ;
You can’t perform that action at this time.
0 commit comments