work around varying GMP behavior in gcdx

fix error cases of invmod, particularly the GMP version
Merge branch 'master' of github.com:JuliaLang/julia
another possible workaround for the GMP gcdx issue
allow more arguments to invmod
fix #4805

this was (predictably) a type intersection problem; apparently an earlier
fix of mine was rendered incorrect and unnecessary by some later work.
add BigInt prevpow2/nextpow2 (fix #4814)
fix #4822, not correctly freeing alloca space around ccalls

this is a critical bug fix
Merge pull request #4820 from stevengj/nextpow2

add BigInt prevpow2/nextpow2 (fix #4814)
allow taking inverses mod 1