-
Notifications
You must be signed in to change notification settings - Fork 280
avoid direct access to exprt::opX #3264
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
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: f8dfd36).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90167415
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.
src/goto-symex/goto_symex_state.cpp
Outdated
return check_renaming_l1( | ||
to_index_expr(to_address_of_expr(expr).object()).array()) || | ||
check_renaming( | ||
to_index_expr(to_address_of_expr(expr).object()).index()); |
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.
Actually this code should be restructured to do the to_address_of_expr
just once as it isn't zero cost.
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.
ok
src/util/json_expr.cpp
Outdated
// try to simplify the constant pointer | ||
return simplify_json_expr(src.op0(), ns); | ||
return simplify_json_expr(to_unary_expr(src).op0(), ns); |
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.
Please add braces to improve readability. And use .op()
instead of .op0()
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.
ok
src/util/json_expr.cpp
Outdated
(value != std::string(value.size(), '0') || | ||
!config.ansi_c.NULL_is_zero) && | ||
src.operands().size() == 1 && | ||
to_unary_expr(src).op0().id() != ID_constant) |
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.
Should be .op()
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.
ok
src/util/ssa_expr.cpp
Outdated
expr.id()==ID_index) | ||
return can_build_identifier(expr.op0()); | ||
else if(expr.id() == ID_member) | ||
return can_build_identifier(to_member_expr(expr).struct_op()); |
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.
Should be .compound()
instead of .struct_op()
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.
ok
f8dfd36
to
b5488f0
Compare
// remove typecast on NULL | ||
(simpl_expr.id() == ID_constant && | ||
simpl_expr.type().id() == ID_pointer && | ||
to_unary_expr(simpl_expr).op().get(ID_value) == ID_NULL)) |
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.
Please add braces below.
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
const auto index_expr = to_index_expr(to_address_of_expr(expr).object()); | ||
return check_renaming_l1(index_expr.array()) || | ||
check_renaming(index_expr.index()); | ||
} |
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 believe this part still needs further work to introduce something along the lines of:
if(expr.id() == ID_address_of)
{
const exprt &object = to_address_of(expr).object();
if(object.id() == ID_symbol)
{
...
}
else if(object.id() == ID_index)
{
...
}
}
if(expr.id() == ID_symbol) // replacing the else if
{
...
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: b5488f0).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90241829
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.
b5488f0
to
6515c3a
Compare
I am quite confused by the complaints by |
Rationale: accesses to exprt::opX can be memory safety violations; it's better to cast to higher type, and then use the named access methods.
6515c3a
to
d6603d3
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: d6603d3).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90310392
Rationale: accesses to exprt::opX can be memory safety violations; it's
better to cast to higher type, and then use the named access methods.