Skip to content

Fix: Do not nondet functions and fix scoping issue #4277

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

Conversation

NlightNFotis
Copy link
Contributor

@NlightNFotis NlightNFotis commented Feb 25, 2019

In goto-harness:

  • we used is_static && is_lvalue to determine something was global.
    Turns out that this also applies to extern functions for some reason,
    so we ended up accidentally creating nondet assignments to those.
    We now check type.id() != ID_code as well.
  • we declared pointers to local variables. In if blocks. Which went
    out of scope before using them. This meant we had a bunch of
    dangling references. We solve this by creating global variables
    for our pointer-pointees instead of local ones.

Co-authored-by: Fotis Koutoulakis [email protected]
Co-authored-by: Hannes Steffenhagen [email protected]

  • 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).
  • 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.

@@ -24,4 +24,4 @@ if [ -e "${name}-mod.gb" ] ; then
fi

$goto_harness "${name}.gb" "${name}-mod.gb" --harness-function-name $entry_point ${args}
$cbmc --function $entry_point "${name}-mod.gb"
$cbmc --function $entry_point "${name}-mod.gb" --unwind 20 --unwinding-assertions

Choose a reason for hiding this comment

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

Basically it’s a bit annoying to hardcode cbmc options here. We’ve been considering changing our chain.sh to allow us to set cbmc options per test case, but we decided to not do this as part of this PR for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@hannes-steffenhagen-diffblue - Might be worth raising this point with @karkhaz as he is currently working on re-writing test.pl in Python and cleaning up a few things at the same time - could be a good time to address chain.sh as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrisr-diffblue We were thinking as part of a later PR to change chain.sh into a python script. This would make it much easier for things like organising configuration of different tool invocations. We'll see if we can leverage the work done on that front as well.

@NlightNFotis NlightNFotis force-pushed the fix-goto-harness-pointer-init branch from 419a958 to 595e91e Compare February 25, 2019 16:29
// a good idea, therefore we just collect the names of globals
// we need to initialise first and then generate the
// initialisation code for all of them.
auto global_names = std::vector<irep_idt>{};
Copy link
Collaborator

Choose a reason for hiding this comment

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

std::vector<irep_idt> global_names; would do.

In goto-harness:
- we used is_static && is_lvalue to determine something was global.
  Turns out that this also applies to extern functions for some reason,
  so we ended up accidentally creating nondet assignments to those.
  We now check type.id() != ID_code as well.
- we declared pointers to local variables. In if blocks. Which went
  out of scope before using them. This meant we had a bunch of
  dangling references. We solve this by creating global variables
  for our pointer-pointees instead of local ones.

Co-authored-by: Fotis Koutoulakis <[email protected]>
Co-authored-by: Hannes Steffenhagen <[email protected]>
@NlightNFotis NlightNFotis force-pushed the fix-goto-harness-pointer-init branch from 595e91e to cefb1dd Compare February 25, 2019 17:13
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 595e91e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102196809
Status will be re-evaluated on next push.
Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)

  • the author is not in the list of contributors (e.g. first-time contributors).

  • the compatibility was already broken by an earlier merge.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: cefb1dd).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102203069

@NlightNFotis NlightNFotis merged commit 5ab4e4a into diffblue:develop Feb 26, 2019
@NlightNFotis NlightNFotis deleted the fix-goto-harness-pointer-init branch February 26, 2019 10:57
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.

5 participants