Skip to content

Refactor process_goto_program so that all tools use common processing code #5807

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

Merged
merged 21 commits into from
Feb 23, 2021

Conversation

martin-cs
Copy link
Collaborator

*_parse_optionst::process_goto_program appears in cbmc, goto-analyze and goto-diff (and maybe the Java tools, @peterschrammel @hannes-steffenhagen-diffblue who is handling these at the moment?) with slight variations, bugs, inconsistencies and omissions. This PR carefully makes them the same (so that we can git-bisect to find any issues this might introduce) and then pulls the common code out into a helper function. This is another step towards a common format for goto-programs and stronger invariants.

This does not break tested functionality but it will have an impact on untested functionality. Mostly, as far as I can see, it goes from 'silently doing the wrong thing' to 'maybe works, maybe breaks in an obvious way'. i consider this a net win.

@martin-cs
Copy link
Collaborator Author

Commit by commit reviewing strongly encouraged.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this clean-up and doing it in such an easy-to-review way!

@martin-cs martin-cs force-pushed the refactor/process_goto_program branch from 8b9bfc3 to b467993 Compare February 13, 2021 14:02
@martin-cs martin-cs force-pushed the refactor/process_goto_program branch 3 times, most recently from f55e9a4 to a8ca58a Compare February 21, 2021 21:30
martin added 15 commits February 22, 2021 17:52
This should not alter observable behaviour.
…stent

This will change the behaviour of goto-analyzer.  I don't think it is
currently tested so I suspect it was unable to handle inline assembler.
This does change the functionality quite substantially but strangely it
only seems to affect one test, and that is syntactic rather than semantic.
As with many of the other changes in this PR, I suspect this is swapping
one lot of broken, untested functionality for another, slightly less broken
but still not working lot of functionality.
The tests aren't really sufficient to tell whether this has an effect.
At the moment this code is dead and is only added to make the
process_goto_program steps more similar.  I will leave it to others
to decide if this is a useful thing to have and add the required command
line options and tests.  Should not affect the behaviour of either tool.
This uncovered a bug in goto-analyzer where the options for goto-check
are recognised but not actually parsed.
This adds some functionality for options that were previously allowed
but silently ignored as they didn't make it from cmdline to goto_check.
This does add functionality but it is of the "used to be silently ignored
but now sort of works or maybe breaks" kind.
In CBMC and goto-diff this is dead, in goto-analyze it preserves the
existing behaviour.  It is not 100% clear to me that the existing behaviour
is useful or desirable but it is preserved as the point of this PR is not
changing behaviour unless necessary.
Rewrite union converts union member access to byte extracts.  This is
(apparently) good for CBMC and goto-diff but it makes analysis harder
for goto-analyzer.  So to make them consistent we add an option which
controls whether it is run or not.  This is fixed in each tool but it
takes us closer to common processing of goto programs.
goto-check makes use of the options assertions, assumptions,
assert-to-assume and retain-trivial.  These were handled to different
degrees and in different way in each of the tools.  This commit adds
these options to the set of options in the *_GOTO_CHECK macros.  This
reduces the amount of duplication and parallel maintenance.
This was included in the options that goto-analyzer recognises and in its
--help output but they were all silently ignored.  This commit fixes that
so that they are supported, making it more consistent with CBMC (and less
inexplicable).
Strangely (or perhaps concerningly) this doesn't seem to break any of
the regression tests.
In the case of goto-analyzer and goto-diff this should be dead code.
In CBMC it reverses the order of string abstraction and non-det statics.
It is conceivable that these two interact but this way around is probably
better.
remove_skip and various other passes compute the updates so moving this
should not effect the behaviour of the program.
martin added 4 commits February 22, 2021 17:52
This requires cosmetic changes to a lot of unit tests.
This requires resolving a difference in the wording of a status message
that breaks a lot of tests for function pointer removal.
@martin-cs martin-cs force-pushed the refactor/process_goto_program branch from a8ca58a to e09efcb Compare February 22, 2021 17:52
@martin-cs
Copy link
Collaborator Author

@hannes-steffenhagen-diffblue and / or @peterschrammel any chance of a review? It looks big but commit by commit it is actually simple and should be easy to review quickly.

@codecov
Copy link

codecov bot commented Feb 22, 2021

Codecov Report

Merging #5807 (c4db021) into develop (aaaf707) will increase coverage by 0.00%.
The diff coverage is 91.22%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5807   +/-   ##
========================================
  Coverage    72.88%   72.89%           
========================================
  Files         1422     1423    +1     
  Lines       154283   154229   -54     
========================================
- Hits        112455   112426   -29     
+ Misses       41828    41803   -25     
Impacted Files Coverage Δ
.../goto-instrument/goto_instrument_parse_options.cpp 58.20% <ø> (-0.08%) ⬇️
...rc/goto-instrument/goto_instrument_parse_options.h 100.00% <ø> (ø)
src/goto-diff/goto_diff_parse_options.cpp 58.67% <75.00%> (-4.13%) ⬇️
src/goto-analyzer/goto_analyzer_parse_options.cpp 73.25% <90.90%> (-0.61%) ⬇️
src/cbmc/cbmc_parse_options.cpp 75.20% <100.00%> (-1.07%) ⬇️
src/goto-programs/process_goto_program.cpp 100.00% <100.00%> (ø)
unit/path_strategies.cpp 99.47% <100.00%> (+<0.01%) ⬆️
src/ansi-c/expr2c.cpp 69.25% <0.00%> (+0.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e989d74...c4db021. Read the comment docs.

Co-authored-by: Peter Schrammel <[email protected]>
@tautschnig tautschnig merged commit 308cc0a into diffblue:develop Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants