Re:On C-optimizing compilers removing code that has undefine...
by andreareina on Saturday June 17, 2017 @05:54AM
(#14575091)
That business about uninitialized values being used to seed RNGs threw me for a loop as well.
I think it's safe to say that x ^= x is equivalent to x = 0 and optimize it that way, just like compilers recognize common idioms for e.g. swapping, counting set bits, etc and emit the correct intrinsic instructions.
Also, the article goes on to argue that uninitialized memory is used to seed random generators, which is generally undefined behavior. I don't think this should be a valid use-case.