Skip to content

Commit e69632e

Browse files
author
Daniel Kroening
authored
Merge pull request #740 from tautschnig/status-assume-false
Print status information upon reaching assume(false)
2 parents f55e413 + 1bc1239 commit e69632e

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

@@ -65,6 +66,21 @@ void symex_bmct::symex_step(
6566

6667
const goto_programt::const_targett cur_pc=state.source.pc;
6768

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

7086
if(record_coverage &&

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)