Skip to content

Simplify non-trivial pointer subtraction #7341

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

Conversation

tautschnig
Copy link
Collaborator

We can also simplify the case where both pointers refer to the same object, as long as the pointers are at most one element beyond bounds.

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

@tautschnig tautschnig requested a review from kroening as a code owner November 13, 2022 23:41
@tautschnig tautschnig added the Kani Bugs or features of importance to Kani Rust Verifier label Nov 13, 2022
@tautschnig tautschnig changed the title Simplify non-trivial pointer subtraction Simplify non-trivial pointer subtraction [depends-on: #7338] Nov 14, 2022
@tautschnig
Copy link
Collaborator Author

Requires #7338 for tests to pass.

We can also simplify the case where both pointers refer to the same
object, as long as the pointers are at most one element beyond bounds.
@tautschnig tautschnig force-pushed the feature/simp-pointer-subtract branch from 6fcf927 to 633875b Compare November 15, 2022 15:03
@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Base: 78.29% // Head: 78.31% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (633875b) compared to base (fb99063).
Patch coverage: 95.96% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7341      +/-   ##
===========================================
+ Coverage    78.29%   78.31%   +0.02%     
===========================================
  Files         1642     1644       +2     
  Lines       190023   190226     +203     
===========================================
+ Hits        148769   148980     +211     
+ Misses       41254    41246       -8     
Impacted Files Coverage Δ
src/solvers/smt2_incremental/object_tracking.h 100.00% <ø> (ø)
..._incremental/smt2_incremental_decision_procedure.h 75.00% <ø> (ø)
...c/goto-programs/ensure_one_backedge_per_target.cpp 84.09% <82.97%> (-1.63%) ⬇️
...t/solvers/smt2_incremental/convert_expr_to_smt.cpp 99.60% <94.73%> (-0.10%) ⬇️
src/solvers/smt2/smt2_conv.cpp 66.97% <95.83%> (+0.18%) ⬆️
src/goto-programs/builtin_functions.cpp 58.95% <100.00%> (+0.43%) ⬆️
src/goto-programs/remove_returns.cpp 98.15% <100.00%> (ø)
src/goto-symex/symex_clean_expr.cpp 93.16% <100.00%> (ø)
src/goto-symex/symex_dereference.cpp 89.89% <100.00%> (+0.10%) ⬆️
...c/solvers/smt2_incremental/convert_expr_to_smt.cpp 83.38% <100.00%> (+0.47%) ⬆️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tautschnig tautschnig marked this pull request as ready for review November 15, 2022 22:39
@tautschnig tautschnig changed the title Simplify non-trivial pointer subtraction [depends-on: #7338] Simplify non-trivial pointer subtraction Nov 15, 2022
Copy link
Member

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

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

Have we got a test for this case?

@peterschrammel peterschrammel removed their assignment Nov 16, 2022
@tautschnig
Copy link
Collaborator Author

tautschnig commented Nov 16, 2022

Have we got a test for this case?

We actually do, because tests failed here when #7338 wasn't yet merged. Also, Pointer_difference2 failed when my initial version had not properly taken into account object bounds.

@tautschnig tautschnig merged commit 7bea872 into diffblue:develop Nov 16, 2022
@tautschnig tautschnig deleted the feature/simp-pointer-subtract branch November 16, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kani Bugs or features of importance to Kani Rust Verifier
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants