Repository navigation
Records kept in memory by value: passed, returned, and copied as their fields - #77
Merged
Merged
Conversation
…r does not represent.
…the release notes.
…the address passed to a callee.
…reseated, and members named whole in modifies as their bytes.
…ere objects are initialized.
…ark it initialized at calls.
…ing each field where it is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A record kept in memory could not be used by value: a local object (every constructed object is one since #76) could not be passed or returned, and a record read as a whole through a pointer or reference could not be passed, returned, or copied. On the base (#76):
Now all three verify. Stacked on #76, the follow-up its "Open" section names.
Design
recordFieldsInMemory): a promoted local, or a record in the object a pointer or a record reference addresses, through implicit copies, moves, and temporaries, is oneVLoadExprper field at its offset from the place's address (objectPlace). Each load carries the place's access condition, which passivization asserts where the load is evaluated, and gets the memory checks of a load from UB instrumentation: in bounds, valid, initialized. So a copy reads what it copies, as C++'s implicit copy does, and fails where a field was never written.appendRecordCallArgument, so calls in expressions too, a spec's included), a record return (through a flattened__aggregate_return_N, assigned before the lifetimes of the locals end), and a copy into a flattened local (appendRecordCopy, which handled promoted locals and now uses the same reads, so pointees too).Tests
suite/record_values_in_memory.cpp(Z3, with a check that no proof is vacuous, and BMC):*ppassed, copied, returned, and given to a spec in a postcondition; a record reference's referent passed and returned;items[2]would becountandspare), failsbounds;initialization.record_references.cpp: a record through a reference passed by value now verifies, where it was an error.On the base every case is an error. Mutants, each built on an assertions build and run on
record_values_in_memory.cpp,constructors.cpp,local_record_arguments.cpp,record_references.cpp,local_object_lifetime.cpp, andlocal_object_unsupported.cpp: 6 of 6 killed.record_values_in_memory,constructorsrecord_values_in_memory(past_elementverifies)record_values_in_memoryrecord_values_in_memoryrecord_values_in_memory,constructorsrecord_values_in_memory(through_pointer)Docs
sum,sum_at); constructed objects by value; records by value.Checked
record_references.cppfailed only its expectation of the error this PR removes (updated since), 1233 s with 40 workers.docs_examples.testanddocs_coverage.testpass.