Skip to content

Commit 1bc1239

Browse files
committed
Print status information upon reaching assume(false)
1 parent 610e9e4 commit 1bc1239

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

src/cbmc/symex_bmc.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Author: Daniel Kroening, [email protected]
99
#include <limits>
1010

1111
#include <util/source_location.h>
12+
#include <util/simplify_expr.h>
1213

1314
#include "symex_bmc.h"
1415

@@ -67,6 +68,21 @@ void symex_bmct::symex_step(
6768
!state.guard.is_false())
6869
symex_coverage.covered(state.source.pc);
6970

71+
if(!state.guard.is_false() &&
72+
state.source.pc->is_assume() &&
73+
simplify_expr(state.source.pc->guard, ns).is_false())
74+
{
75+
statistics() << "aborting path on assume(false) at "
76+
<< state.source.pc->source_location
77+
<< " thread " << state.source.thread_nr;
78+
79+
const irep_idt &c=state.source.pc->source_location.get_comment();
80+
if(!c.empty())
81+
statistics() << ": " << c;
82+
83+
statistics() << eom;
84+
}
85+
7086
goto_symext::symex_step(goto_functions, state);
7187
}
7288

src/symex/path_search.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Author: Daniel Kroening, [email protected]
66
77
\*******************************************************************/
88

9+
#include <util/simplify_expr.h>
910
#include <util/time_stopping.h>
1011

1112
#include <solvers/flattening/bv_pointers.h>
@@ -315,8 +316,10 @@ Function: path_searcht::drop_state
315316
316317
\*******************************************************************/
317318

318-
bool path_searcht::drop_state(const statet &state) const
319+
bool path_searcht::drop_state(const statet &state)
319320
{
321+
goto_programt::const_targett pc=state.get_instruction();
322+
320323
// depth limit
321324
if(depth_limit_set && state.get_depth()>depth_limit)
322325
return true;
@@ -345,6 +348,22 @@ bool path_searcht::drop_state(const statet &state) const
345348
return true;
346349
}
347350

351+
if(pc->is_assume() &&
352+
simplify_expr(pc->guard, ns).is_false())
353+
{
354+
debug() << "aborting path on assume(false) at "
355+
<< pc->source_location
356+
<< " thread " << state.get_current_thread();
357+
358+
const irep_idt &c=pc->source_location.get_comment();
359+
if(!c.empty())
360+
debug() << ": " << c;
361+
362+
debug() << eom;
363+
364+
return true;
365+
}
366+
348367
return false;
349368
}
350369

src/symex/path_search.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class path_searcht:public safety_checkert
120120
bool is_feasible(statet &state);
121121
void do_show_vcc(statet &state);
122122

123-
bool drop_state(const statet &state) const;
123+
bool drop_state(const statet &state);
124124

125125
void report_statistics();
126126

0 commit comments

Comments
 (0)