-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Array pointer ignores offset #43056
Copy link
Copy link
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorgood first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Julia
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorgood first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Julia
When getting a pointer from an array (via the pointer function) the resulting memory address describes the beginning of the array, but ignores the array's offset. AFAIK the offset is used to efficiently "soft" delete objects at the beginning of the array (here). If this is in-fact the case, then the offset should be taken into account when returning the memory address of the start of the array (here). Specifically, instead of having
jl_array_ptrreturna->datawe might want to returna->data + a->offset.A reproducible example follows below. Note that the memory-address doesn't change even after calling
popfirst!(). I expect that the memory-address would increment after the call topopfirst!().