Re: integer overflow in mini-gmp due to integer promotion

2023-07-19 Thread Vincent Lefevre
On 2023-07-19 22:08:24 +0200, Niels Möller wrote: > Vincent Lefevre writes: > > > On 2023-07-19 21:24:03 +0200, Niels Möller wrote: > >> I think that's needed, to be able to support any size of > >> MINI_GMP_LIMB_TYPE. Something like > >> > >> #define umullo_limb(u, v) \ > >>

Re: integer overflow in mini-gmp due to integer promotion

2023-07-19 Thread Niels Möller
Vincent Lefevre writes: > On 2023-07-19 21:24:03 +0200, Niels Möller wrote: >> I think that's needed, to be able to support any size of >> MINI_GMP_LIMB_TYPE. Something like >> >> #define umullo_limb(u, v) \ >> (sizeof(mp_limb_t) >= sizeof(int)) ? (u)*(v) : (unsigned int)(u) * (v)) >> >> If

Re: integer overflow in mini-gmp due to integer promotion

2023-07-19 Thread Torbjörn Granlund
Vincent Lefevre writes: The goal is to try to find bugs in MPFR. With limbs of small size, particular cases (such as some limbs being 0 or -1) could occur more often. Have you looked at GMP's asl.h? It allows for tiny limbs, but GMP needs work before any small limbs size fully works.

Re: integer overflow in mini-gmp due to integer promotion

2023-07-19 Thread Vincent Lefevre
On 2023-07-19 21:24:03 +0200, Niels Möller wrote: > Vincent Lefevre writes: > > > ./configure --with-mini-gmp=/home/vlefevre/software/gmp/mini-gmp CC=gcc-13 > > CFLAGS="-O2 -fsanitize=undefined -fno-sanitize-recover > > -DMINI_GMP_LIMB_TYPE=short" > > > > I get lots of failures in mini-gmp.c

Re: integer overflow in mini-gmp due to integer promotion

2023-07-19 Thread Niels Möller
Vincent Lefevre writes: > ./configure --with-mini-gmp=/home/vlefevre/software/gmp/mini-gmp CC=gcc-13 > CFLAGS="-O2 -fsanitize=undefined -fno-sanitize-recover > -DMINI_GMP_LIMB_TYPE=short" > > I get lots of failures in mini-gmp.c (I suspect that the errors were > hidden by some optimization in

integer overflow in mini-gmp due to integer promotion

2023-07-19 Thread Vincent Lefevre
Hi, When I test MPFR with ./configure --with-mini-gmp=/home/vlefevre/software/gmp/mini-gmp CC=gcc-13 CFLAGS="-O2 -fsanitize=undefined -fno-sanitize-recover -DMINI_GMP_LIMB_TYPE=short" I get lots of failures in mini-gmp.c (I suspect that the errors were hidden by some optimization in GCC 12