Skip to content

goto-symex: print status note and conditional warning for self-loops #6624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions regression/cbmc/self_loops_to_assumptions1/default.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CORE
main.c
--unwind 1 --unwinding-assertions
^replacing self-loop at file main.c line 3 function main by assume\(FALSE\)$
^no unwinding assertion will be generated for self-loop at file main.c line 3 function main$
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
1 change: 1 addition & 0 deletions regression/cbmc/self_loops_to_assumptions1/no-assume.desc
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ main.c
^SIGNAL=0$
^VERIFICATION FAILED$
--
^replacing self-loop
27 changes: 18 additions & 9 deletions src/goto-symex/symex_goto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ Author: Daniel Kroening, [email protected]
/// \file
/// Symbolic Execution

#include "goto_symex.h"
#include "goto_symex_is_constant.h"

#include <algorithm>

#include <util/exception_utils.h>
#include <util/expr_util.h>
#include <util/invariant.h>
Expand All @@ -22,11 +17,16 @@ Author: Daniel Kroening, [email protected]
#include <util/simplify_expr.h>
#include <util/std_expr.h>

#include <langapi/language_util.h>
#include <pointer-analysis/add_failed_symbols.h>
#include <pointer-analysis/value_set_dereference.h>

#include "goto_symex.h"
#include "goto_symex_is_constant.h"
#include "path_storage.h"

#include <algorithm>

void goto_symext::apply_goto_condition(
goto_symex_statet &current_state,
goto_statet &jump_taken_state,
Expand Down Expand Up @@ -279,10 +279,19 @@ void goto_symext::symex_goto(statet &state)
{
// generate assume(false) or a suitable negation if this
// instruction is a conditional goto
if(new_guard.is_true())
symex_assume_l2(state, false_exprt());
else
symex_assume_l2(state, not_exprt(new_guard));
exprt negated_guard = not_exprt{new_guard};
do_simplify(negated_guard);
log.statistics() << "replacing self-loop at "
<< state.source.pc->source_location() << " by assume("
<< from_expr(ns, state.source.function_id, negated_guard)
<< ")" << messaget::eom;
if(symex_config.unwinding_assertions)
{
log.warning()
<< "no unwinding assertion will be generated for self-loop at "
<< state.source.pc->source_location() << messaget::eom;
}
symex_assume_l2(state, negated_guard);

// next instruction
symex_transition(state);
Expand Down