Use collapse(2) when not building with gcc 4.8.1

See bug #9456.