I merged your changes, and made several analogous changes. The code now passes strict compilation with and without HAVE_GMP.
I did not merge the tests changes yet. Please grab our version from our repo. If your repo is public, please let me now how to access it. Else, please either send a diff -c between your version and our repo version, or your full file. -- Torbjörn