mpn_mul problem on m68k

Alan alanh at fairlite.co.uk
Tue May 17 11:44:20 CEST 2011


Hello,

I've been talking to Vincent Lefevre over at the MPFR lists and we've
found a GCC optimizer problem with gmp 5.0.1 on m68k with the following
test program....

#include <stdio.h>
#include <gmp.h>

int main (void)
{
mp_limb_t src[5] =
{ 0x90000000, 0xbaa55f4f, 0x2cbec4d9, 0xfcef3242, 0xda827999 };
mp_limb_t dst[10];

gmp_printf ("%Nx\n", src, 5);
mpn_sqr (dst, src, 5);
gmp_printf ("%Nx\n", dst, 10);

return 0;
}

Correct output:

da827999fcef32422cbec4d9baa55f4f90000000
ba827999fcef32422cbec4d9baa55f4f90e826a733471e7e41fbe2b5bd4bc59a3100000000000000

Buggy output:

da827999fcef32422cbec4d9baa55f4f90000000
ba82cc519d4132422cbf8d193e285f4f90e80c11ab3d1e7e41fc254d17b9c59a3100510000000000

The only way to avoid this is build without optimization, and I'm using
gcc 4.5.2 from gentoo.

Let me know if this should be handled here, or reported to the gcc folks
instead.

Thanks,

Alan.


More information about the gmp-bugs mailing list