Skip to content

Memory predicate tests and one-argument form [depends-on: #2644] #2706

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

Closed
wants to merge 5 commits into from

Conversation

qaphla
Copy link

@qaphla qaphla commented Aug 9, 2018

This adds two commits on top of #2644. The first commit slightly extends the functionality by adding a one-argument form (which infers the size from the type), while the second commit adds tests. The first three commits are just those from #2644 (which in turn takes two from #2635).

I expect there to be a lot of discussion on #2644 and likely many changes before anything gets merged in so it's likely that this should get mostly ignored until that point. However, the test cases in here may be useful for informing whatever functionality eventually comes from the discussion on #2644.

klaas added 5 commits July 30, 2018 14:54
This change exposes is_lvalue for use outside of
goto-programs/builtin_functions.cpp.
The --expand-pointer-predicates pass resolves pointer predicates
(util/pointer_predicates.{cpp, h}) which have side effects and
so require expanding into multiple instructions.
Currently, the only such predicate that needs to be expanded is
__CPROVER_points_to_valid_memory (name subject to change).

The __CPROVER_points_to_valid_memory predicates takes two parameters,
a pointer and a size. Semantically,
__CPROVER_points_to_valid_memory(p, size) should be true if and only
if p points to a memory object which is valid to read/write for at
least size bytes past p. When used in assertions, this will be checked
in a similar manner to how --pointer-check checks validity of a
dereference. When used in assumptions, this predicate creates (if none
exists already) an object for p to refer to, using
local_bitvector_analysis to make that determination, and then makes
assumptions (again corresponding to the assertions made by
--pointer-check) about that object.
This commit adds support for a one-argument form of
__CPROVER_points_to_valid_memory, taking only a pointer, with no size.

If ptr has type T*, then __CPROVER_points_to_valid_memory(ptr) is
equivalent to __CPROVER_points_to_valid_memory(ptr, sizeof(T)).
@tautschnig tautschnig self-assigned this Nov 10, 2018
@tautschnig tautschnig removed their assignment Jan 4, 2019
@karkhaz karkhaz mentioned this pull request Jan 11, 2019
@tautschnig tautschnig changed the title Memory predicate tests and one-argument form Memory predicate tests and one-argument form [depends-on: #2644] Feb 25, 2019
@tautschnig tautschnig self-assigned this Feb 26, 2019
@TGWDB
Copy link
Contributor

TGWDB commented May 3, 2023

Closing due to age (no further comment on PR content), please reopen with rebase on develop if you intent to continue this work.

@TGWDB TGWDB closed this May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants