P2434R5 — Nondeterministic pointer provenance
S. Davis Herring
CWGLWGSG22
[P2318R1](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2318r1.pdf) describes a variety of plausible models of pointer provenance that differ principally in how they handle conversions between pointers and integers (including the integer values of the storage bytes for a pointer). (See its §A.4 for discussion of the variants in terms of examples.) It proposes the variant called PNVI-ae-udi, which does seem to provide a good combination of optimization possibilities and support for existing code. However, in several cases it is overly charitable to the programmer: for example, using an explicit copy loop rather than calling `std::memcpy` “exposes” storage, which can interfere with optimization, even if the byte values obviously do not escape. (The paper proposes to eventually add annotations to avoid such unwanted side effects.) It also sometimes depends in an apparently arbitrary fashion on the order of operations with no data dependencies (as in the `pointer_from_integer_1ig.c` example with an exposure of `j` added).