Skip to content

Commit 3bcb5ff

Browse files
committed
Add documentation and refactor incremental one loop changes
`check_break` is now documented in `goto_symex.h` as well (I removed the parameters that were not used anywhere).
1 parent 8fb9cd3 commit 3bcb5ff

File tree

6 files changed

+14
-26
lines changed

6 files changed

+14
-26
lines changed

regression/cbmc-incr-oneloop/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
default: tests.log
22

3+
# Note the `perl -e` serves the purpose of providing timeout
34
test:
45
@../test.pl -c "perl -e 'alarm shift @ARGV; exec @ARGV' 8 ../../../src/cbmc/cbmc --slice-formula"
56

src/goto-checker/symex_bmc_incremental_one_loop.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ bool symex_bmc_incremental_one_loopt::should_stop_unwind(
101101
/// corresponds to the given loop (incr_loop_id)
102102
bool symex_bmc_incremental_one_loopt::check_break(
103103
const irep_idt &id,
104-
bool is_function,
105-
statet &state,
106-
const exprt &cond,
107104
unsigned unwind)
108105
{
109106
if(unwind < incr_min_unwind)

src/goto-checker/symex_bmc_incremental_one_loop.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ class symex_bmc_incremental_one_loopt : public symex_bmct
4040
// returns true if the symbolic execution is to be interrupted for checking
4141
bool check_break(
4242
const irep_idt &id,
43-
bool is_function,
44-
goto_symext::statet &state,
45-
const exprt &cond,
4643
unsigned unwind) override;
4744

4845
bool should_stop_unwind(

src/goto-symex/goto_symex.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,16 @@ class goto_symext
168168
/// by the symbolic executions.
169169
bool ignore_assertions = false;
170170

171+
/// \brief Defines condition for interrupting symbolic execution for a
172+
/// specific loop
173+
///
174+
/// False constant by default, over-ridden by incremental BMC implementation
175+
/// to allow breaking if the unwinding the user specified loop
176+
/// \param id: the loop identifier
177+
/// \param unwind: current unwinding counter
178+
/// \return true if the symbolic execution is to be interrupted for checking
171179
virtual bool check_break(
172180
const irep_idt &id,
173-
bool is_function,
174-
statet &state,
175-
const exprt &cond,
176181
unsigned unwind);
177182

178183
protected:

src/goto-symex/symex_goto.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ void goto_symext::symex_goto(statet &state)
287287
if(new_guard.is_true())
288288
{
289289
// we continue executing the loop
290-
if(check_break(loop_id, false, state, new_guard, unwind))
290+
if(check_break(loop_id, unwind))
291291
{
292292
should_pause_symex = true;
293293
}
@@ -584,12 +584,7 @@ void goto_symext::symex_unreachable_goto(statet &state)
584584
symex_transition(state);
585585
}
586586

587-
bool goto_symext::check_break(
588-
const irep_idt &id,
589-
bool is_function,
590-
statet &state,
591-
const exprt &cond,
592-
unsigned unwind)
587+
bool goto_symext::check_break(const irep_idt &id, unsigned unwind)
593588
{
594589
// dummy implementation
595590
return false;

src/goto-symex/symex_target_equation.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,15 +333,8 @@ void symex_target_equationt::convert_without_assertions(
333333

334334
void symex_target_equationt::convert(decision_proceduret &decision_procedure)
335335
{
336-
convert_guards(decision_procedure);
337-
convert_assignments(decision_procedure);
338-
convert_decls(decision_procedure);
339-
convert_assumptions(decision_procedure);
336+
convert_without_assertions(decision_procedure);
340337
convert_assertions(decision_procedure);
341-
convert_goto_instructions(decision_procedure);
342-
convert_function_calls(decision_procedure);
343-
convert_io(decision_procedure);
344-
convert_constraints(decision_procedure);
345338
}
346339

347340
void symex_target_equationt::convert_assignments(
@@ -476,7 +469,7 @@ void symex_target_equationt::convert_assertions(
476469
{
477470
for(auto &step : SSA_steps)
478471
{
479-
// ignore already converted assertions in the error trace
472+
// hide already converted assertions in the error trace
480473
if(step.is_assert() && step.converted)
481474
step.hidden = true;
482475

@@ -503,7 +496,7 @@ void symex_target_equationt::convert_assertions(
503496

504497
for(auto &step : SSA_steps)
505498
{
506-
// ignore already converted assertions in the error trace
499+
// hide already converted assertions in the error trace
507500
if(step.is_assert() && step.converted)
508501
step.hidden = true;
509502

0 commit comments

Comments
 (0)