Skip to content

Add nondet initialisation of strings in goto-harness. #4285

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 2 commits into from
Mar 4, 2019

Conversation

NlightNFotis
Copy link
Contributor

@NlightNFotis NlightNFotis commented Feb 27, 2019

Add the capability to non-deterministically initialise strings in goto-harness call-function harness generator.

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

@@ -48,6 +48,9 @@ struct function_call_harness_generatort::implt
std::set<irep_idt> function_parameters_to_treat_as_arrays;
std::set<irep_idt> function_arguments_to_treat_as_arrays;

std::set<irep_idt> function_parameters_to_treat_as_cstrings;

Choose a reason for hiding this comment

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

FWIW I think we need to start more cleanly separating between what we get for command-line options and what things we generate as intermediates based on that.

Copy link
Contributor

Choose a reason for hiding this comment

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

unordered_set!

Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Also, given how this is used, I don't understand why aren't you using a map (param -> value)? It seems to me, keeping them as separate maps forces you to add more manual checks, while you could be relying on the type system to do that for you.

@NlightNFotis NlightNFotis force-pushed the nondet-strings branch 2 times, most recently from f178c76 to 7d57a85 Compare February 27, 2019 14:17
Copy link
Contributor

@xbauch xbauch left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

There is nothing that alarms me about the changes compared to the array init work, but I do note that a lot of the comments that were made on that PR (in particular those by @LAJW) apply here as well and should be carefully considered.

@sonodtt
Copy link
Contributor

sonodtt commented Feb 28, 2019

Great work on the documentation. That's a significant amount of effort in terms of both structure and examples - and I appreciate how hard that can be. Marvellous.
I think it will pay off handsomely in the medium to long term, and deducing all this from the code... unreliable at best.

Copy link
Contributor

@sonodtt sonodtt left a comment

Choose a reason for hiding this comment

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

Just some minor checks on the documentation.

@sonodtt sonodtt self-requested a review February 28, 2019 15:28
@NlightNFotis NlightNFotis dismissed sonodtt’s stale review February 28, 2019 15:32

Unintended blocker review

@@ -48,6 +48,9 @@ struct function_call_harness_generatort::implt
std::set<irep_idt> function_parameters_to_treat_as_arrays;
std::set<irep_idt> function_arguments_to_treat_as_arrays;

std::set<irep_idt> function_parameters_to_treat_as_cstrings;
Copy link
Contributor

Choose a reason for hiding this comment

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

unordered_set!

@@ -48,6 +48,9 @@ struct function_call_harness_generatort::implt
std::set<irep_idt> function_parameters_to_treat_as_arrays;
std::set<irep_idt> function_arguments_to_treat_as_arrays;

std::set<irep_idt> function_parameters_to_treat_as_cstrings;
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Also, given how this is used, I don't understand why aren't you using a map (param -> value)? It seems to me, keeping them as separate maps forces you to add more manual checks, while you could be relying on the type system to do that for you.

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

NlightNFotis and others added 2 commits March 1, 2019 10:58
Add support for nondet-initialisation of strings in
the function-call goto-harness leveraging pointer
nondet initialisation.

Co-authored-by: Fotis Koutoulakis <[email protected]>
Co-authored-by: Hannes Steffenhagen <[email protected]>
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: ac740d6).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102802228

for(const auto &pointer_to_treat_as_string_name :
pointers_to_treat_as_cstrings)
{
out << "\n " << pointer_to_treat_as_string_name << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use join_strings

@NlightNFotis NlightNFotis merged commit f3300d6 into diffblue:develop Mar 4, 2019
@NlightNFotis NlightNFotis deleted the nondet-strings branch March 4, 2019 10:21
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.

9 participants