-
Notifications
You must be signed in to change notification settings - Fork 273
Add capability to export goto-program in symex-ready-goto form to CBMC. #7697
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
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #7697 +/- ##
===========================================
- Coverage 78.56% 78.55% -0.02%
===========================================
Files 1685 1685
Lines 192927 192979 +52
===========================================
+ Hits 151579 151596 +17
- Misses 41348 41383 +35
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
src/cbmc/cbmc_parse_options.cpp
Outdated
// At this point, our goto-model should be in core-goto form (all of the | ||
// transformations have been run and the program is ready to be given to the | ||
// solver). | ||
if(cmdline.isset("export-core-goto")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ I think that ideally the contents of cmdline
should be validated and written to options
in the cbmc_parse_optionst::get_command_line_options
function, before the options are acted on at this point in the control flow. This helps separate the validation of the command line arguments supplied by the user from the code which acts on the options that are specified by those arguments. Think of cmdline
as being the parse tree and options
as being the setting being acted upon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/cbmc/cbmc_parse_options.cpp
Outdated
// solver). | ||
if(cmdline.isset("export-core-goto")) | ||
{ | ||
auto core_goto_filename = cmdline.get_value("export-core-goto"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ What happens if the user specifies --export-core-goto
without specifying an output filename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added extra checks for a missing filename.
e1aba25
to
259afed
Compare
src/cbmc/cbmc_parse_options.cpp
Outdated
if(options.is_set("export-core-goto")) | ||
{ | ||
auto core_goto_filename = options.get_option("export-core-goto"); | ||
if(core_goto_filename.empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check belongs back where the option is set. That way we can halt processing before going to the effort of building the goto-model in memory.
src/cbmc/cbmc_parse_options.cpp
Outdated
return CPROVER_EXIT_INTERNAL_ERROR; | ||
} | ||
|
||
auto success = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ bool
please?
src/cbmc/cbmc_parse_options.cpp
Outdated
<< core_goto_filename << messaget::eom; | ||
return CPROVER_EXIT_INTERNAL_ERROR; | ||
} | ||
log.status() << "Exported goto-program in core-goto form at " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ I'd put these 2 lines in an else block. Just so that the two blocks of code of equivalent control flow significance are at the same level of indentation.
f92fcd6
to
f53978d
Compare
Please reconsider the name "core goto". This word carries no meaning for users. How about "pre-symex-goto". Is there a particular reason to have this facility in CBMC, as opposed to |
Hi @kroening, The name Since core-goto is already in the documentation/repository, we would prefer to keep the terminology for this PR. If you have suggestions for a better name, we'd happily consider this in a later PR that renames globally rather than conflating renaming other in parts of the codebase with the functionality here. With regards to the flag being added to The primary challenge with experimenting with altenative locations for the implementation is that we can't remain confident about the state of the goto-program in those alternative locations, and given the lack of a programatic check for the model being in Note that once your PR #7695 is merged we can check that a goto model is in core-goto form, and so safely output core goto from other binaries such as |
3467688
to
72121ef
Compare
I would strongly urge to revisit this terminology. We have a multi-backend strategy, and every backend will have a different set of requirements on the language features it handles well. Hence, there is no "core". I do not see how you can establish a particular goto program form as a "core" given that both consumers and producers have very different needs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding a block on this PR because I'd like to settle the discussion on the idea of a "core goto program".
As described in previous PR #7505 the "core goto" is choosing a place where all required instrumentation/simplification transforms have been done for the goto program to be consumable by symex/checking. So I see there being two potential areas of discussion and resolution.
With the above in mind, let's progress down path 1 here. I believe there is desire to decouple the form from the concept of symex and consider it to be a form suitable for many kinds of checkers. I'd like to hear opinions on "checkable-goto" or other potential names (in addition to "core goto" and "pre symex goto") to see if we can agree on something that is expressive and helpful. (I'm not sure my name suggestion is great, but wanted to get the discussion started ASAP.) |
It's really essential here to think beyond symex. We want to be able to deliver a portfolio of backend engines/solvers for the same verification task. In particular, we want to phase out BMC in favour of methods that can do unbounded proof. These backends will have vastly different requirements about the goto features that they support or handle well. It therefore doesn't make sense to identify one single set of features as "core". Furthermore, it is important not to do the modelling equivalent of "premature optimisation". You want to stay high-level as long as possible, as it is difficult to undo any lowering once it has happened. |
3c08f37
to
a97ba0b
Compare
Some squashing would be nice. |
a97ba0b
to
6d3fbee
Compare
As agreed we changed the concept of core-goto to symex-ready-goto as the symex after the transformations. This commit rewrites the documentation accordingly.
This allows CBMC to dump the goto-program when it is in core-goto form in a file on disk (when it is just before SYMEX, and all transformations have been applied). This allows CBMC to dump the goto-program when it is in symex-ready-goto form in a file on disk (i.e. just before SYMEX, and all transformations have been applied).
6d3fbee
to
85558fe
Compare
85558fe
to
95aa842
Compare
95aa842
to
1e26b7f
Compare
This allows CBMC to dump the goto-program when it is in symex-ready-goto form in a file on disk (when it is just before SYMEX, and all transformations have been applied).