Skip to content
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

Contracts and Harnesses for <*mut T>::add, sub and offset #113

Merged
merged 32 commits into from
Nov 27, 2024

Conversation

stogaru
Copy link

@stogaru stogaru commented Oct 12, 2024

Towards #76

Changes

  • Adds contracts for <*mut T>::add, <*mut T>::sub and <*mut T>::offset
  • Adds proofs for contracts of the above functions verifying the pointee types:
    • All integer types
    • Tuples (composite type)
    • Unit Type
  • Defines a macro for add and sub and another for offset.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@stogaru stogaru requested a review from a team as a code owner October 12, 2024 00:19
library/core/src/ptr/mut_ptr.rs Show resolved Hide resolved
library/core/src/ptr/mut_ptr.rs Outdated Show resolved Hide resolved
@xsxszab
Copy link

xsxszab commented Nov 15, 2024

@zhassan-aws Hi the proofs have been updated to use pointer generator, however after the update we encountered a strange test failure, probably a bug: the test case check_mut_add_u8 constantly fails with the following output:

SUMMARY:
 ** 1 of 293 failed (4 unreachable)
Failed Checks: Only a single top-level call to function _RNCNCNvMNtNtCs1YNGORL5zck_4core3ptr7mut_ptrOh3adds0_0s_0Ba_ when checking contract _RNCNCNvMNtNtCs1YNGORL5zck_4core3ptr7mut_ptrOh3adds0_0s_0Ba_
 File: "/Users/xsxsz/vscode-projects/verify-rust-std/library/core/src/ptr/mut_ptr.rs", line 1019, in _RNCNCNvMNtNtCs1YNGORL5zck_4core3ptr7mut_ptrOh3adds0_0s_0Ba_

VERIFICATION:- FAILED
Verification Time: 0.45757997s

All other proofs generated by the same macro work fine. Is there any possible cause for this problem? For now, we have to skip this test case by commenting it out.

Update: The const counterpart check_const_add_u8 in another PR (#166) works fine. This information might help locate the issue

@zhassan-aws
Copy link

@celinval encountered the same issue in #37 (comment). @celinval were you able to figure out what is causing the error and whether there's a workaround?

@celinval
Copy link

Yes, the problem is that the pointer generator code is likely using the API you are trying to verify. For the harness that is failing, you won't be able to use the generator as is today. Sorry!

Copy link

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

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

Thanks

library/core/src/ptr/mut_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/mut_ptr.rs Show resolved Hide resolved
@feliperodri feliperodri enabled auto-merge (squash) November 27, 2024 18:26
@feliperodri feliperodri merged commit 014965a into model-checking:main Nov 27, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants