Skip to content

Commit 4fbc03c

Browse files
Merge pull request #369 from peterschrammel/graphml-correctness-witnesses
Graphml correctness witnesses
2 parents 83d996f + dd2d3b0 commit 4fbc03c

File tree

5 files changed

+306
-45
lines changed

5 files changed

+306
-45
lines changed

src/cbmc/bmc.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Author: Daniel Kroening, [email protected]
1313
#include <util/string2int.h>
1414
#include <util/i2string.h>
1515
#include <util/source_location.h>
16+
#include <util/string_utils.h>
1617
#include <util/time_stopping.h>
1718
#include <util/message.h>
1819
#include <util/json.h>
@@ -131,6 +132,8 @@ void bmct::output_graphml(
131132
graphml_witnesst graphml_witness(ns);
132133
if(result==UNSAFE)
133134
graphml_witness(safety_checkert::error_trace);
135+
else if(result==SAFE)
136+
graphml_witness(equation);
134137
else
135138
return;
136139

@@ -379,8 +382,9 @@ void bmct::show_program()
379382
{
380383
std::string string_value;
381384
languages.from_expr(step.ssa_lhs, string_value);
382-
std::cout << "(" << count << ") SHARED_" << (step.is_shared_write()?"WRITE":"READ") << "("
383-
<< string_value <<") " << "\n";
385+
std::cout << "(" << count << ") SHARED_"
386+
<< (step.is_shared_write()?"WRITE":"READ")
387+
<< "(" << string_value <<")\n";
384388

385389
if(!step.guard.is_true())
386390
{
@@ -544,6 +548,7 @@ safety_checkert::resultt bmct::run(
544548
symex.remaining_vccs==0)
545549
{
546550
report_success();
551+
output_graphml(SAFE, goto_functions);
547552
return safety_checkert::SAFE;
548553
}
549554

@@ -619,6 +624,7 @@ safety_checkert::resultt bmct::stop_on_fail(
619624
{
620625
case decision_proceduret::D_UNSATISFIABLE:
621626
report_success();
627+
output_graphml(SAFE, goto_functions);
622628
return SAFE;
623629

624630
case decision_proceduret::D_SATISFIABLE:
@@ -661,13 +667,11 @@ Function: bmct::setup_unwind
661667
void bmct::setup_unwind()
662668
{
663669
const std::string &set=options.get_option("unwindset");
664-
std::string::size_type length=set.length();
670+
std::vector<std::string> unwindset_loops;
671+
split_string(set, ',', unwindset_loops, true, true);
665672

666-
for(std::string::size_type idx=0; idx<length; idx++)
673+
for(auto & val : unwindset_loops)
667674
{
668-
std::string::size_type next=set.find(",", idx);
669-
std::string val=set.substr(idx, next-idx);
670-
671675
unsigned thread_nr;
672676
bool thread_nr_set=false;
673677

@@ -691,9 +695,6 @@ void bmct::setup_unwind()
691695
else
692696
symex.set_unwind_loop_limit(id, uw);
693697
}
694-
695-
if(next==std::string::npos) break;
696-
idx=next;
697698
}
698699

699700
if(options.get_option("unwind")!="")

0 commit comments

Comments
 (0)