[PATCH] D21218: [LibFuzzer] Avoid using std::random_swap() due to platform differences and implement our own version.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 12:28:14 PDT 2016

delcypher added a comment.

In http://reviews.llvm.org/D21218#456101, @kcc wrote:

> Can you just change the number of iterations to e.g. 1<<20 or 1<<21?

That is the very first thing I tried and that does allow the test to pass on OSX but that's a terrible fix which just hides the underlying issue. I think it is **very undesirable** to have mutation behavior differ between platforms. The fact that the unit tests use a fix seed for the PRNG suggests to me that the author was trying to make the test behave consistently. Having tests behave consistently is a good thing and I don't understand why we would want only partially consistent behavior by not bothering to make random shuffle behave consistently.

I am more than happy to debate what the algorithm should be but I very strongly believe that LibFuzzer's reliance on `std::random_shuffle` needs to be removed.


More information about the llvm-commits mailing list