Skip to content

Conversation

kroening
Copy link
Member

@kroening kroening commented Nov 3, 2018

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.

  • 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.
  • 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.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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

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());
Copy link
Collaborator

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

// try to simplify the constant pointer
return simplify_json_expr(src.op0(), ns);
return simplify_json_expr(to_unary_expr(src).op0(), ns);
Copy link
Collaborator

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()

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

(value != std::string(value.size(), '0') ||
!config.ansi_c.NULL_is_zero) &&
src.operands().size() == 1 &&
to_unary_expr(src).op0().id() != ID_constant)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be .op()

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

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());
Copy link
Collaborator

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()

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@tautschnig tautschnig assigned kroening and unassigned tautschnig Nov 4, 2018
@kroening kroening assigned tautschnig and unassigned kroening Nov 5, 2018
// 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))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add braces below.

Copy link
Member Author

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());
}
Copy link
Collaborator

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

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

@tautschnig tautschnig assigned kroening and unassigned tautschnig Nov 5, 2018
@tautschnig
Copy link
Collaborator

I am quite confused by the complaints by clang-format, those seem rather unrelated to the changes. @kroening, could you please rebase?

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

@tautschnig tautschnig merged commit 27742dd into develop Nov 5, 2018
@tautschnig tautschnig deleted the exprt_opX_accesses branch November 5, 2018 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants