Skip to content

Add transformation to instrument a program with asserts & Produce invariants from Apron#157

Merged
michael-schwarz merged 95 commits intomasterfrom
instrument_with_asserts
Apr 1, 2022
Merged

Add transformation to instrument a program with asserts & Produce invariants from Apron#157
michael-schwarz merged 95 commits intomasterfrom
instrument_with_asserts

Conversation

@michael-schwarz
Copy link
Copy Markdown
Member

@michael-schwarz michael-schwarz commented Dec 17, 2020

Instrument a given program with asserts based on the analysis results. Enable with --sets trans.activated[+] assert. Writes the instrumented file into the file specified in trans.output.

Limitations

  • Currently only works for local, top-level variables (i.e. not arrays, structures, ...) of integer type
  • Asserts all local variables after join, ideally one would like to only modify ones that were modified in one of the branches
  • Removes comments from files, if the input program has //UNKNOWN annotations, this will remove them, and they will fail when running Goblint again.

Use Cases

  • To compare precision between runs and/or configurations
  • Theoretically, one could take arbitrary programs (without UB), annotate them, compile and execute. If any of the asserts is violated, this is an unsoundness in Goblint.

This is based on @Fayanzar work submitted for his Master's thesis (extracted from #150)

@michael-schwarz
Copy link
Copy Markdown
Member Author

michael-schwarz commented Dec 21, 2020

Things that remain TODO:

  • Assertions about globals as well
  • Assertions with some offset (not just Cil.NoOffset)
  • Assertions in pieces of code that are unreachable

@michael-schwarz
Copy link
Copy Markdown
Member Author

Possible improvement: Reduce the number of assert(0) inserted into unreachable code.

@michael-schwarz michael-schwarz requested a review from sim642 March 31, 2022 07:07
@michael-schwarz
Copy link
Copy Markdown
Member Author

I tested with octMPQ, it is still significantly slower than octD (10.075 s vs 3.299 s) and finds the same invariants on the programs I tested with, so octD still seems like the better choice.
(Side remark: I had some trouble getting it to compile with octMPQ, it would not find apron.octMPQ. For some reason opam reinstall apron fixed the issue.)

@michael-schwarz michael-schwarz requested a review from sim642 April 1, 2022 07:46
@michael-schwarz michael-schwarz merged commit e754868 into master Apr 1, 2022
@michael-schwarz michael-schwarz deleted the instrument_with_asserts branch April 1, 2022 09:04
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
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.

4 participants