Rewrite the wrap checks to deal with gcc 4.x optimisations.