Bug#724320: gmp: x32: sizeof(mp_limb_t)!=sizeof(void*) is not supported by GAP and PARI

Vincent Lefevre vincent at vinc17.net
Wed Oct 2 02:17:27 CEST 2013


On 2013-10-01 21:34:40 +0200, Bill Allombert wrote:
> On Tue, Oct 01, 2013 at 08:32:50PM +0200, Max Horn wrote:
> > As a GAP developer, I actually agree, this is a bug in GAP. As such, I would
> > like to see a proper bug report about this directed towards us, so we can
> > think about fixing the issue. As it is, I only noticed this thread here by
> > chance, first time I heard about the problem :-). But perhaps I missed
> > something -- Bill, did you ever report this on GAP support or the GAP
> > tracker?
> 
> No, there is no plan to include x32 as an official Debian architecture at this
> point, so I will not involve myself more. Furthermore GAP upstream
> tarball includes its own copy of GMP which is compiled with flags to ensure
> compatibility with GAP.

On PowerPC, one can build GMP with the mode32 ABI (-m32 -mpowerpc64),
which uses a 64-bit limb on a 32-bit architecture. Is there a similar
ABI on x86?

I've tried

  ./configure ABI=x32 CFLAGS='-O2 -pedantic -fomit-frame-pointer -m32'

with GMP 5.1.2, but the build fails. Adding --disable-assembly solves
the problem, but it makes GMP very slow! With that, I get:

--> char
CHAR_BIT = 8
char is signed.
CHAR_MIN = - 2^7 = -128
SCHAR_MIN = - 2^7 = -128
SCHAR_MAX = 2^7 - 1 = 127
UCHAR_MAX = 2^8 - 1 = 255
MB_LEN_MAX = 16

--> short / unsigned short
SHRT_MIN = - 2^15 = -32768
SHRT_MAX = 2^15 - 1 = 32767
USHRT_MAX = 2^16 - 1 = 65535
sizeof(short) = 2, signed
sizeof(unsigned short) = 2, unsigned

--> int / unsigned int
INT_MIN = - 2^31 = -2147483648
INT_MAX = 2^31 - 1 = 2147483647
UINT_MAX = 2^32 - 1 = 4294967295
sizeof(int) = 4, signed
sizeof(unsigned int) = 4, unsigned

--> long / unsigned long
LONG_MIN = - 2^31 = -2147483648
LONG_MAX = 2^31 - 1 = 2147483647
ULONG_MAX = 2^32 - 1 = 4294967295
sizeof(long) = 4, signed
sizeof(unsigned long) = 4, unsigned

--> long long / unsigned long long
LLONG_MIN = - 2^63 = -9223372036854775808
LLONG_MAX = 2^63 - 1 = 9223372036854775807
ULLONG_MAX = 2^64 - 1 = 18446744073709551615
sizeof(long long) = 8, signed
sizeof(unsigned long long) = 8, unsigned

--> pointers / memory
sizeof(void *) = 4

--> GMP
__GMP_MP_SIZE_T_INT = 0
GMP_LIMB_BITS = 64
GMP_NAIL_BITS = 0
GMP_NUMB_BITS = 64
sizeof(mp_limb_t) = 8, unsigned
sizeof(mp_exp_t) = 4, signed

This seems to actually correspond to x32.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list