Skip to content

Add precondition that pointers point to structs in the object factory #4483

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

antlechner
Copy link
Contributor

I've been trying to find out what kinds of exprts can be passed to the object factory, and in the case of pointers, the only two cases that appeared in the code were pointers to structs and pointers to void*. The latter had a comment saying that it applies to #exception_values, which according to @smowton have been replaced.

I tried adding a precondition that pointers always point to structs, ran most of the tests locally and haven't found any failures yet. So I am assuming that it is now safe to make this change.

I would like to do some refactoring for the struct case in follow-up PRs, so if reviewers think that there is any way that a pointer could still end up in the object factory and point to something other than a struct, please let me know and I will close this PR and instead add a test for this case.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a 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). [Various existing tests require constructing nondet values in the object factory.]
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • n/a My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

It looks like this previously wasn't possible because of void* types of
exceptions. But exceptions are now handled differently and not nondet-
initialized any more, so it should be safe to add the precondition.
@antlechner antlechner force-pushed the antonia/jof-struct-invariants branch from d195cc2 to 7cada1b Compare April 4, 2019 14:03
Copy link
Contributor

@owen-mc-diffblue owen-mc-diffblue left a comment

Choose a reason for hiding this comment

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

Assuming CI passes

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: 7cada1b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107086687

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: d195cc2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107095507
Status will be re-evaluated on next push.
Common spurious failures include: 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); compatibility was already broken by an earlier merge.

@tautschnig tautschnig merged commit c312a18 into diffblue:develop Apr 4, 2019
@antlechner antlechner deleted the antonia/jof-struct-invariants branch April 5, 2019 08:40
@antlechner antlechner restored the antonia/jof-struct-invariants branch April 5, 2019 08:43
@antlechner
Copy link
Contributor Author

This causes a few test failures in TG, all of which are related to Strings. I will try to reproduce these failures using JBMC and either fix the problem or revert this PR and add a regression test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants