Note that the compare function is used also internally, to order the arrays and choose which element compare against in the next round.
If your compare function is not really comparing (ie. returns 0 if elements are equals, 1 otherwise), you will receive an unexpected result.