bug in t-perfpow for mingw64

Alexander Maly a.a.maly at gmail.com
Mon Sep 13 16:41:29 CEST 2010

gmp-5.0.1 "Current performance release"

Test program is tests/mpz/t-perfpow.c in the source tree.

It reports "n was destroyed, but perfpow_p still believes n is a perfect
N is really the perfect power. What is wrong - when function 'check_random'
tries to "destroy" n,
that is to make powers for primes to be with gcd=1, it calls internal
function 'mpn_gcd_1', giving it (as the first argument) pointer to the
variable g, that is defined to be unsigned long int. But mpn_gcd_1 requies a
pointer to the mp_limb_t, that is 64-bit wide. So I guess in mingw64 long is
32-bit wide, that is quite unusual for 64-bit ABI. Correcting the variable g
type definition to mp_limb_t makes the test pass well.

./configure --build=core2-w64-mingw32

Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: ../../src/gcc-4.5.1/configure
--prefix=/crossdev/prefix-tdm64 -
-build=x86_64-w64-mingw32 --enable-targets=all --enable-libgomp --enable-lto
nable-libstdcxx-debug --enable-languages=c,c++,fortran,objc,obj-c++
rror --disable-nls --disable-win32-registry
bs --enable-fully-dynamic-string --with-pkgversion=tdm64-1
Thread model: win32
gcc version 4.5.1 (tdm64-1)

MINGW32_NT-6.1 DARKSTAR 1.0.11(0.46/3/2) 2009-07-11 17:46 i686 Msys


Regards, Alexander.

More information about the gmp-bugs mailing list