Skip to content

Allocate nondet char array #3259

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

Conversation

romainbrenguier
Copy link
Contributor

make_nondet_infonite_char_array was not allocating the array as a
dynamic object. This means if this code was added in a function called
several times then the array would get overwritten each time.
This problem was not visible by the string refinement as it associates a
independent array to each string and does not care about memory
allocation, but can be a problem for the interpreter.

  • Each commit message has a non-empty body, explaining why the change was made.
  • [na] Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • 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.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@romainbrenguier
Copy link
Contributor Author

Tests will be added here: https://github.com/diffblue/test-gen/pull/2441

@romainbrenguier
Copy link
Contributor Author

A unit test needs to be updated

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: 05cddb1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90242967
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

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 incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Nitpicks only

{
side_effect_exprt alloc(ID_allocate, lhs.type(), lhs.source_location());
alloc.copy_to_operands(size);
alloc.copy_to_operands(false_exprt());
Copy link
Contributor

Choose a reason for hiding this comment

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

Use add_to_operands (allows move)

make_nondet_infonite_char_array was not allocating the array as a
dynamic object. This means if this code was added in a function called
several time then the array would get overwritten each time.
This problem was not visible by the string refinement as it associates a
independent array to each string and does not care about memory
allocation, but can be a problem for the interpreter.
The string creation in java_object_factory was allocating a char array,
which is already done in make_nondet_char_array.
We remove the duplicate allocation and simplify
make_nondet_infinite_char_array by using make_allocate_code which was
used in the java_object_factory version.
@romainbrenguier romainbrenguier force-pushed the bugfix/allocate-nondet-char-array branch from 05cddb1 to 130c190 Compare November 6, 2018 07:57
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: 130c190).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90382716

@romainbrenguier romainbrenguier merged commit e401667 into diffblue:develop Nov 6, 2018
@romainbrenguier romainbrenguier deleted the bugfix/allocate-nondet-char-array branch November 6, 2018 10:04
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