.
In my experience, valgrind *does* complain (loudly) about out-of-bounds
access, without any additional options.
A close inspection shows that there actually was no out-of-bounds access
in the no-if program, because the arrays were massively over-allocated.
The relevant portion of the allocation code is:
int size0fInt = sizeof(int64_t) * 8 - 1;
<...>
array2sort = (int64_t*)malloc(N0fItems * size0fInt);
Note that size0fInt is almost 8 times larger than needed.
Note for those doing searches: size0fint is spelled with a zero, not an
Oh. In many fonts, it's hard to notice that.
OK - that makes me feel better about valgrind, a little worse about my
own ability to notice such things, and a lot worse about the competence
of the author of that code. The fact that you're the first person to
mention that problem, in a very long thread, makes me feel a little less
sheepish.
The size0fint calculation seems to have been copied over, without
understanding, from the calculation of size0fT1 in pseudoRNG() which was
a size in bits, rather than bytes. That calculation was based upon the
assumption that CHAR_BIT==8 is guaranteed - a fairly popular assumption,
and for practical purposes, one of the less dangerous incorrect
assumptions. The -1 means that size0fT1 was a misnomer. In the original
context, it would have been clearer to write:
int size0fT1 = sizeof(uint64_t) * 8;
sign = (seed >> (size0fT1-1));
But it seems consistent with his other behavior that our micro-optimizer
was afraid that his compiler would fail to notice that size0fT1-1 was a
constant expression that could be lifted out of the loop. In the
calculation of size0fint, the -1 is just plain nonsense.