Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/buffer_suballocation/mapped_bytes.v
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module main

// Keep this helper for compatibility with older V3 compilers (vlang/v#31481).
// Passing the pointer value into a fresh scope prevents a heap-promoted
// pointer slot from being used as the byte-store destination.
// Keep this helper for older V3 compilers affected by vlang/v#31481.
// Newer V3 fixes that issue, but stable V 0.5.2 still fails its escaping-pointer
// reproducer, even though this example passes without the helper. Passing the
// pointer value into a fresh scope keeps byte stores directed at mapped memory
// instead of a heap-promoted pointer slot.
fn store_mapped_byte(mapped voidptr, value u8) {
unsafe {
*(&u8(mapped)) = value
Expand Down