-
Notifications
You must be signed in to change notification settings - Fork 274
Use CProverString.format as interface to the solver builtin function #4477
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
Use CProverString.format as interface to the solver builtin function #4477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sensible
fad62ee
to
e74d753
Compare
801c355
to
147a223
Compare
There was a problem hiding this 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: e74d753).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106699730
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.
660b193
to
1acddc7
Compare
There was a problem hiding this 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: 660b193).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106716601
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.
06785cc
to
fe27d99
Compare
There was a problem hiding this 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: 211fd5e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106879072
7a920a1
to
e45a2d0
Compare
There was a problem hiding this 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: 06e7e9f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106916333
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.
There was a problem hiding this 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: 7a920a1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106919141
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.
There was a problem hiding this 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: e45a2d0).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106922534
const exprt as_int = format_arg_from_string(string, ID_int); | ||
return typecast_exprt{as_int, floatbv_typet{}}; | ||
} | ||
UNHANDLED_CASE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
byte, short, double and long are not handled yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are all handled by being cast to a long within the model. So ID_int does not need to make a distinction between byte, short, int and long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by comment: so what about double
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also cast to a long. ID_float handles both the cases where the formatting string except a float and a double (this was the same before my PR).
This makes the link between the CProverString.format signature from java and the ID_cprover_string_format_func from the solver.
This makes it accept a function as argument, which gives for possible types the corresponding value of the argument. This will allow us to adapt more easily to a change in the way the arguments of format are given: they are now given as a struct but we want to have the possibility to give them as a string.
Add the possibility to pass argument to the builtin format function as strings instead of structs with fields.
add_axioms_from_int_hex is deprecated, we use add_axioms_for_string_of_int_with_radix instead.
This should now be in the model, and the implementation of models can use CProverString.format.
This tests the new implementation of String.format using the java models.
To use the builtin format function, the java entry point is now CProverString.format, so we can remove the legacy code which was handling String.format directly.
Reflects the new way the argument are passed to the format builtin function.
e45a2d0
to
7c34ea4
Compare
The java-models-library update is now pointing to master |
There was a problem hiding this 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: 7c34ea4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106943324
The way
String.format
is implemented in the string preprocessing is hacky and buggy.By adding a
CProverString.format
function as interface, the preprocessing becomes very simple, the complexity is then transfered to the java models, for which it is much easier to write clean code (than goto-program for java).This should go together with an update of the models: diffblue/java-models-library#20