Skip to content

Commit 2d2c18e

Browse files
Petr BauchPetr Bauch
authored andcommitted
Move assignment to init-flag to harness-function
Now that we do not presuppose cprove_initialize the assignment has to be somewhere.
1 parent 010f0a8 commit 2d2c18e

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/goto-harness/memory_snapshot_harness_generator.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,12 @@ void memory_snapshot_harness_generatort::add_init_section(
170170
goto_modelt &goto_model) const
171171
{
172172
goto_functionst &goto_functions = goto_model.goto_functions;
173-
symbol_tablet &symbol_table = goto_model.symbol_table;
174173

175174
goto_functiont &goto_function =
176175
goto_functions.function_map[entry_function_name];
177-
const symbolt &function_symbol = symbol_table.lookup_ref(entry_function_name);
178176

179177
goto_programt &goto_program = goto_function.body;
180178

181-
// introduce a symbol for a Boolean variable to indicate the point at which
182-
// the function initialisation is completed
183-
symbolt &func_init_done_symbol = get_fresh_aux_symbol(
184-
bool_typet(),
185-
id2string(entry_function_name),
186-
"func_init_done",
187-
function_symbol.location,
188-
function_symbol.mode,
189-
symbol_table);
190-
func_init_done_symbol.is_static_lifetime = true;
191-
func_init_done_symbol.value = false_exprt();
192-
193-
const symbol_exprt func_init_done_var = func_init_done_symbol.symbol_expr();
194-
195179
const goto_programt::const_targett start_it =
196180
goto_program.instructions.begin();
197181

@@ -235,6 +219,9 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals(
235219
recursive_initialization.initialize(symbol.symbol_expr(), 0, {}, code);
236220
}
237221
}
222+
223+
code.add(code_assignt{func_init_done_var, false_exprt{}});
224+
238225
return code;
239226
}
240227

@@ -337,6 +324,19 @@ void memory_snapshot_harness_generatort::generate(
337324
const symbolt *called_function_symbol =
338325
symbol_table.lookup(entry_function_name);
339326

327+
// introduce a symbol for a Boolean variable to indicate the point at which
328+
// the function initialisation is completed
329+
auto &func_init_done_symbol = get_fresh_aux_symbol(
330+
bool_typet(),
331+
id2string(entry_function_name),
332+
"func_init_done",
333+
source_locationt::nil(),
334+
called_function_symbol->mode,
335+
symbol_table);
336+
func_init_done_symbol.is_static_lifetime = true;
337+
func_init_done_symbol.value = false_exprt();
338+
func_init_done_var = func_init_done_symbol.symbol_expr();
339+
340340
add_init_section(goto_model);
341341

342342
code_blockt harness_function_body =

src/goto-harness/memory_snapshot_harness_generator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ class memory_snapshot_harness_generatort : public goto_harness_generatort
159159
optionalt<unsigned> line_number;
160160
optionalt<goto_programt::const_targett> start_instruction;
161161

162+
symbol_exprt func_init_done_var;
163+
162164
message_handlert &message_handler;
163165
};
164166

0 commit comments

Comments
 (0)