mpn_mul problem on m68k

Zimmermann Paul Paul.Zimmermann at loria.fr
Wed May 18 09:14:02 CEST 2011


       Hi,

> 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.

as suggested by Vincent, whatever the reason of the problem (in GCC or GMP), it
would be good to add this test in the GMP test suite, so that "make check"
fails.

Paul Zimmermann


More information about the gmp-bugs mailing list