Compiling GMP with clang

Torbjörn Granlund tg at
Sat Nov 29 10:49:09 UTC 2014

I've added clang as an alternative compiler for the nightly GMP builds.
The results are not encouraging, we're triggering many problems.

For some reason, clang purports to be gcc.  This makes GMP and other
packages expect it to work as GCC.  Unfortunately, it does not.  I've
accomodated the simple problems with GMP checkins the last week, hoping
not to break things for (current or past) gcc.

There are at least 4 problems still remaining.

1. The default ABI and ISA for a MIPS64 r1 system is MIPS32 r2 code.  It
   is strange to generate 32-bit code by default for a 64-bit system,
   but even worse to generate code which will not run.  This affects the
   various gen-*.c programs expected to run on the host during
   compilation.  They don't, and we have no mechanism for tweaking this
   as we expect "gcc hello.c; ./a.out" to just work.

2. A likely miscompilation on powerpc64.  The symptom is
     /home/tege/prec/gmp-snap/tests/mpn/t-div.c:486: GNU MP assertion failed:
     qp[nn - 1] == qran1
     FAIL: t-div
   We have not isolated this yet.  Help is welcome.  Failure log:

3. Link errors on some arm32 systems.  We have not investigates this.
   Help is welcome. Failure log:

4. Lots and lots of failures for some arm32 systems.  The problem is
   related to seeding in the test harness.  Possibly this is related to
   floating point operations and parameter passing.
   Failure log:
This is all clang 3.5.  With clang 3.4, miscompilation seems to be the

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list