Skip to content

Add support for void* pointers in goto-harness #5290

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 11 commits into from
Apr 9, 2020

Conversation

thk123
Copy link
Contributor

@thk123 thk123 commented Apr 8, 2020

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Thomas Kiley added 5 commits April 8, 2020 18:04
Currently goto-harness crashes with this example.
This ensures they are simply set to null, avoiding a crash (or any
strange initlization of memory of an unknown type)
Reduces duplication between the code that produces the different
branches that return null
@thk123 thk123 force-pushed the goto-harness-void-star-pointers branch from 9987033 to 46ce648 Compare April 8, 2020 17:04
Thomas Kiley added 3 commits April 9, 2020 10:27
The current behaviour trips over an invariant. This is the only sesnible
behaviour, as cannot sensibly malloc an array of void
@thk123 thk123 force-pushed the goto-harness-void-star-pointers branch from 46ce648 to ce0ec56 Compare April 9, 2020 09:47
if(type.subtype().id() == ID_empty)
{
// always initalize void* pointers as NULL
return build_null_pointer(result_symbol);

Choose a reason for hiding this comment

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

This is OK for now, but longer term we'll have to think of a better solution for this (although meaningful void* arguments are tricky, and tbh shouldn't be appearing very often in the sort of harnesses we're trying to generate right now).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feel free to raise a ticket - though tbh I'm not really sure what other useful behaviour exists. A non-det switch over all types? I guess we could do something similar to JBMC where we look at the subsequent casts to pick a type.

Thomas Kiley added 2 commits April 9, 2020 12:03
Here the array contains pointers, so we can sensibly create a non-null
array here.
@thk123 thk123 force-pushed the goto-harness-void-star-pointers branch from ce0ec56 to 11a48f4 Compare April 9, 2020 11:03
On Travis, these are printed out as assert 0 rather than assert false
{
__CPROVER_assume(input_array != 0);
assert(input_array[0] == 0);
assert(false);

Choose a reason for hiding this comment

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

👍 A lot of tests forget this step

@codecov-io
Copy link

codecov-io commented Apr 9, 2020

Codecov Report

Merging #5290 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5290   +/-   ##
========================================
  Coverage    67.95%   67.95%           
========================================
  Files         1170     1170           
  Lines        96362    96371    +9     
========================================
+ Hits         65478    65487    +9     
  Misses       30884    30884           
Flag Coverage Δ
#cproversmt2 42.40% <ø> (ø)
#regression 64.45% <100.00%> (+<0.01%) ⬆️
#unit 31.76% <ø> (ø)
Impacted Files Coverage Δ
src/goto-harness/recursive_initialization.cpp 86.56% <100.00%> (+0.28%) ⬆️

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 5c1f7bb...2f2a233. Read the comment docs.

@thk123 thk123 merged commit 8911c0a into diffblue:develop Apr 9, 2020
@thk123 thk123 deleted the goto-harness-void-star-pointers branch April 9, 2020 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants