Skip to content

Commit 04ce98f

Browse files
committed
Validate goto models in cbmc (if enabled via command line flag)
1 parent eb5d6b0 commit 04ce98f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/cbmc/cbmc_parse_options.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ int cbmc_parse_optionst::doit()
530530
if(set_properties())
531531
return CPROVER_EXIT_SET_PROPERTIES_FAILED;
532532

533+
if(cmdline.isset("validate-goto-model"))
534+
{
535+
goto_model.validate(validation_modet::INVARIANT);
536+
}
537+
533538
return bmct::do_language_agnostic_bmc(
534539
path_strategy_chooser, options, goto_model, ui_message_handler);
535540
}
@@ -977,6 +982,8 @@ void cbmc_parse_optionst::help()
977982
" --xml-ui use XML-formatted output\n"
978983
" --xml-interface bi-directional XML interface\n"
979984
" --json-ui use JSON-formatted output\n"
985+
// NOLINTNEXTLINE(whitespace/line_length)
986+
HELP_VALIDATE
980987
HELP_GOTO_TRACE
981988
HELP_FLUSH
982989
" --verbosity # verbosity level\n"

src/cbmc/cbmc_parse_options.h

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/ui_message.h>
1616
#include <util/parse_options.h>
1717
#include <util/timestamper.h>
18+
#include <util/validation_interface.h>
1819

1920
#include <langapi/language.h>
2021

@@ -73,6 +74,7 @@ class optionst;
7374
OPT_FLUSH \
7475
"(localize-faults)(localize-faults-method):" \
7576
OPT_GOTO_TRACE \
77+
OPT_VALIDATE \
7678
"(claim):(show-claims)(floatbv)(all-claims)(all-properties)" // legacy, and will eventually disappear // NOLINT(whitespace/line_length)
7779
// clang-format on
7880

src/goto-programs/initialize_goto_model.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ goto_modelt initialize_goto_model(
165165
goto_model.goto_functions,
166166
message_handler);
167167

168+
if(cmdline.isset("validate-goto-model"))
169+
{
170+
goto_model.validate(validation_modet::EXCEPTION);
171+
}
172+
168173
// stupid hack
169174
config.set_object_bits_from_symbol_table(
170175
goto_model.symbol_table);

0 commit comments

Comments
 (0)