Am 10/3/2024 um 3:23 PM schrieb Mathieu Desnoyers:
What _does_ work however are the following two approaches: 1) Perform the equality check on the original variables, creating new versions (with OPTIMIZER_HIDE_VAR) of both variables for the rest of their use, therefore making sure the pointer dereference are not derived from versions of the variables which were compared with another pointer. (as suggested by Boqun)
This should not be guaranteed to work, because right after the comparison the compiler can do b=a, then it doesn't matter how much you hide afterwards.
However it might work if you escape the addresses of a and b first, in which case the compiler will not do b=a anymore, but it might force the compiler to put a and b on the stack, which has some performance impact.
2) Perform the equality check on the versions resulting of hiding both variables, making sure those versions of the variables are not dereferenced afterwards. (as suggested by Linus)
jonas