| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| ```k | ||
| // `prove-rs/interior-mut3.rs` needs this | ||
| // TODO: check its correctness, I assume the pointer offset is the address here and we can use it to recover the PtrLocal |
There was a problem hiding this comment.
Unfortunately this is not correct. The PTR_OFFSET here is an index into an array of elements of a certain type T. To get what would be an address in a byte-addressed memory you have to multiply it with the size of one element in bytes. sizeof<T>.
This becomes interesting for the alignment check when pointers are cast from one element type to another.
Sorry, something went wrong.
There was a problem hiding this comment.
The PTR_OFFSET is a local OFFSET for the structure?
Sorry, something went wrong.
Add a `#cast` rule for `castKindTransmute` that handles `PtrLocal` to integer type conversion. The rule extracts the pointer offset from metadata and converts it to the target integer type via `#intAsType`. A helper function `#ptrOffsetBytes` computes byte offsets from pointer offsets, accounting for array element sizes when the pointee is an unsized array type. This fixes the `interior-mut3` test which uses `UnsafeCell::get()` (internally transmutes a pointer to `usize` for alignment checks). The proof now passes cleanly in 333 steps instead of getting stuck on unresolved alignment assertions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements Miri-style lazy address allocation (Issue #1002): Configuration: - `<addressMap>`: maps allocation keys to (base_address, size) pairs - `<nextAddress>`: next available address (starts at 4096 to avoid NULL) - `<exposedSet>`: tracks allocations with exposed provenance Semantics: - `#allocAddressFor`: lazily assigns aligned base addresses on demand - `#alignUp`: aligns addresses to type alignment requirements - `castKindTransmute` PtrLocal→int: computes base + byte_offset - `castKindPointerExposeAddress`: same as transmute but also exposes provenance Verified via LLVM backend execution: - interior-mut3-fail.rs reaches #EndProgram (alignment check passes with addr=4096) - Address uniqueness: different locals get different base addresses Note: Haskell backend (prove) performance regresses due to 3 new configuration cells increasing the matching state space. This needs further optimization (e.g. cell multiplicity annotations or rule priorities). Closes #1002 Supersedes #812, #877 Fixes #638 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidate test coverage from superseded PRs into this branch: - interior-mut3.rs (from #812) - ptr_offset.rs (from #877) - alignment-check.rs, local-raw.rs, ptr-through-wrapper.rs, raw-ptr-cast.rs, ref-ptr-cast-elem.rs, ref-ptr-cast-elem-offset.rs (from #1004) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements Miri-style lazy address allocation (Issue #1002): Configuration: - `<addressMap>`: maps allocation keys to (base_address, size) pairs - `<nextAddress>`: next available address (starts at 4096 to avoid NULL) - `<exposedSet>`: tracks allocations with exposed provenance Semantics: - `#allocAddressFor`: lazily assigns aligned base addresses on demand - `#alignUp`: aligns addresses to type alignment requirements - `castKindTransmute` PtrLocal→int: computes base + byte_offset - `castKindPointerExposeAddress`: same as transmute but also exposes provenance Verified via LLVM backend execution: - interior-mut3-fail.rs reaches #EndProgram (alignment check passes with addr=4096) - Address uniqueness: different locals get different base addresses Note: Haskell backend (prove) performance regresses due to 3 new configuration cells increasing the matching state space. This needs further optimization (e.g. cell multiplicity annotations or rule priorities). Closes #1002 Supersedes #812, #877 Fixes #638 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidate test coverage from superseded PRs into this branch: - interior-mut3.rs (from #812) - ptr_offset.rs (from #877) - alignment-check.rs, local-raw.rs, ptr-through-wrapper.rs, raw-ptr-cast.rs, ref-ptr-cast-elem.rs, ref-ptr-cast-elem-offset.rs (from #1004) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
No description provided.