Pointer comparisons ignore provenance
Pointer comparisons ignore provenance
Posted Oct 16, 2024 18:40 UTC (Wed) by tialaramex (subscriber, #21167)In reply to: Pointer comparisons ignore provenance by Tobu
Parent article: Zapping pointers out of thin air
You can't prove me wrong because the only difference in (2) is that it's possible to get a different answer, but never required, so, I can tell you that you just got unlucky and that's why it seems as though I implement (1).
So the rational thing to do is implement (1) which is at least explainable.
Posted Oct 19, 2024 19:41 UTC (Sat)
by NYKevin (subscriber, #129325)
[Link] (2 responses)
(1) provides neither of those guarantees, so it is not equivalent to (2) no matter how lucky or unlucky I might get.
Posted Oct 19, 2024 19:46 UTC (Sat)
by NYKevin (subscriber, #129325)
[Link] (1 responses)
Posted Oct 20, 2024 8:43 UTC (Sun)
by tialaramex (subscriber, #21167)
[Link]
If you want your numbering to exclusively refer to a specific thing you once wrote somewhere you're going to need much bigger numbers, I recommend 128-bit UUIDs for this work, however, since we're talking among people, I would suggest that naming things, though it has some undesirable quirks, is preferable, that's why the "worst case" provenance model offered in Rust and the default provenance proposed for C is referred to as "PNVI-ae-udi" rather than some hard to distinguish UUID, when I typo'd that name earlier everybody still knew what I meant.
As to the substance: Useless "optimisations" have to be painstakingly eliminated so there's no reason to ask for them knowing that you won't use them. Yes it is likely that LLVM will decide they can "optimise" ptrA == ptrB in some way that's not helpful, and if they want to do that Rust will just emit the IR for ptrA.addr() == ptrB.addr() instead so that it gets the required semantics. Today it doesn't matter because (as I wrote) there's an LLVM bug and as a result LLVM can believe that for two machine integers A, B A != B but A - B = 0 which is nonsense and the LLVM devs know it's nonsense but it's a consequence of this sort of "optimisation".
Pointer comparisons ignore provenance
Pointer comparisons ignore provenance
Pointer comparisons ignore provenance