-
Notifications
You must be signed in to change notification settings - Fork 273
deprecate exprt::make_typecast(type) #3856
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
kroening
commented
Jan 19, 2019
- 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).
- n/a My commit message includes data points confirming performance improvements (if claimed).
- 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.
ac2c3d6
to
bdd49b0
Compare
29a3eed
to
d1cdcea
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: d1cdcea).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97936959
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.
Some comments below with one additional nit-pick: the commit messages have typos (s/save/safe/).
|
||
if(tmp.type()!=expr.type()) | ||
tmp.make_typecast(expr.type()); | ||
tmp = typecast_exprt::conditional_cast(tmp, expr.type()); | ||
|
||
expr.swap(tmp); |
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.
I think that's expr = typecast_exprt::conditional_cast(expr.op0().op0(), expr.type());
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.
sure
src/solvers/flattening/arrays.cpp
Outdated
make_typecast(indices_equal.op0().type()); | ||
} | ||
indices_equal.op1() = typecast_exprt::conditional_cast( | ||
indices_equal.op1(), indices_equal.op0().type()); |
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.
I'd put this right in the constructor:
equal_exprt indices_equal(*i1, typecast_exprt::conditional_cast(*i2, i1->type()));
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.
done
src/util/pointer_predicates.cpp
Outdated
object_offset.make_typecast(access_size.type()); | ||
sum=plus_exprt(object_offset, access_size); | ||
const auto object_offset_casted = | ||
typecast_exprt::conditional_cast(object_offset, access_size.type()); |
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.
I'm not entirely happy with this happening here - on the one hand because it's already being done in 8f52d81, and on the other hand because it does only one part of the work (it doesn't remove ns
from the parameter list).
b99beb8
to
f4b91a8
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: b99beb8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98135668
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.
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: f4b91a8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98138802
This is fundamentally not type-safe; the type of the expression will change. The compiler is unable to assert memory safety.
.make_typecast() isn't type safe; use the constructor for the resulting expression instead.
.make_typecast() isn't type safe; when used in the pattern if(a.type()!=b.type()) ... then use typecast_exprt::conditional_cast instead.
f4b91a8
to
49b0670
Compare
Rebased to resolve conflicts. |
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: 49b0670).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98376149