|
|
|
|
|
by afdbcreid
12 days ago
|
|
Do note though that strict provenance in Rust does work (at least we're not aware of any miscompilation AFAIK), and pre-strict-provenance semantics, or exposed provenance semantics, are warned against in the docs and clarify that they do not have accepted formal semantics. So the situation is a bit better than C. |
|
My favourite example is ColdString, a value the same size as a thin pointer and which could be pointing at some text on the heap - but for smaller texts it is actually inline UTF-8 encoded text, the author originally wrote this to rely on the scary Exposure rules and I asked them if it couldn't be Strict instead and instead of "If you're so smart why don't you do it then?" they just fixed it. Nice. Huge fan of ColdString.
However, there are extant examples where you can just trick LLVM into asserting that two integers a,b are different and then showing that a - b == 0 which proves it was lying, those are by definition miscompilations and they don't rely on Exposure, they're just getting the LLVM optimiser to apply a pointer provenance optimisation to a thing it was just told is not a pointer.