work around varying GMP behavior in gcdx

fix error cases of invmod, particularly the GMP version
Merge branch 'master' of github.com:JuliaLang/julia