There is no sorting algorithm that is O(n log n) in time, O(1) in space and also stable. Pick your poison.
miniblog.
Related Posts
Nice overview of undefined behaviour in LLVM: https://www.cs.utah.edu/~regehr/llvm-ub.pdf (looks like poison may be removed entirely!)
What's the best poison value to use for kernel malloc? OpenBSD eventually concluded that it depends on the arch: