Skip to content

Implement model for String.equals #2588

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 8 commits into from
Oct 1, 2018

Conversation

codebyzeb
Copy link
Contributor

String.equals currently handled by CBMC, this removes support
within CBMC so that String.equals will be handled by a model instead.
Includes a pointer update to the definition change in the
java-models-library submodule.

@codebyzeb
Copy link
Contributor Author

Pointer update to: diffblue/java-models-library#7

@tautschnig
Copy link
Collaborator

I am a nominated reviewer, but I'd hope for @romainbrenguier and @cesaro to weigh in/approve.

@@ -1,5 +1,5 @@
public class test
{

Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably an involuntary change

@romainbrenguier romainbrenguier force-pushed the zgoriely/string-equals branch from 6a07c37 to c37762f Compare August 1, 2018 07:47
@romainbrenguier romainbrenguier force-pushed the zgoriely/string-equals branch 5 times, most recently from e0a5597 to 444c186 Compare August 6, 2018 10:10
compute_inverse_function(stream, axiom.univ_var, val, index);
implies_exprt instance(
compute_inverse_function(axiom.univ_var, val, index);
exprt instance = implies_exprt(

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I removed this change

@@ -63,6 +63,14 @@ public static StringBuilder deleteCharAt(StringBuilder sb, int index) {
return sb.deleteCharAt(index);
}

public static boolean equals(String a, String b)

Choose a reason for hiding this comment

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

Why is this here in the regression folder? We are loading models library so I thought the method is implemented there now.

Copy link
Contributor

Choose a reason for hiding this comment

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

🦅


if(width==0)
return conversion_failed(expr);
if(operands.empty() && width == 0)

Choose a reason for hiding this comment

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

Has this been investigated?

exprt::operandst conjuncts;
for(const auto &index : indexes)
for(const auto &index : find_indexes(axiom.body, str, axiom.univ_var))

Choose a reason for hiding this comment

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

I'm not sure if I understood this correctly but if there is more than one index via which we access str, all of them would get replaced with the same new index var which is not correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

If there are several indexes then we get the conjunction of the replacement.
For instance for a formula forall q. s[q+x]='a' && s[q]=c we would get s[v] = 'a' && s[v-x] = c && s[v+x] = 'a' && s[v] = c.
I will add this example to the doxygen.

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

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

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

@romainbrenguier romainbrenguier force-pushed the zgoriely/string-equals branch 2 times, most recently from 408cba9 to a5cce05 Compare September 28, 2018 06:56
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: 408cba9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86245748
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).

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

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

@romainbrenguier romainbrenguier force-pushed the zgoriely/string-equals branch 3 times, most recently from af56a9b to 9f3d360 Compare October 1, 2018 08:16
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: 9f3d360).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86437726
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).

codebyzeb and others added 8 commits October 1, 2018 15:43
Includes a pointer update to the definition change in the
java-models-library submodule.
String.equals currently handled by CBMC, this removes support
within CBMC so that String.equals will be handled by a model instead.
CProverString.equals is provided by JBMC instead of String.equals.
The thing we warn about is not an error in itself and it's unlikely the
user will understand what this talks about.
The fact that the array is always accessed at the same index, is not a
necessary condition for the correctness of the instantiate function.
@romainbrenguier
Copy link
Contributor

submodule update now pointing to master

@romainbrenguier romainbrenguier merged commit 46cd50b into diffblue:develop Oct 1, 2018
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: 87bd027).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86492208
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).

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