I can confirm that the memset zero size bug does exist in certain
versions of gcc. We have seen it with MPIR. I believe we saw it with
gcc 4.1.2 on a Pentium D.

See here:

http://trac.mpir.org/mpir_trac/ticket/168

Bill.

On 14 July, 13:03, "Dr. David Kirkby" <[email protected]> wrote:
> Just so there is a record of this on sage-devel, Paul now thinks the bug
> is in the compiler, which I have observed with some versions of gcc
>
> gcc-3.4.3 : 0 MPFR failures
> gcc-4.1.1 : 0 MPFR failures
> gcc-4.2.1 : 0 MPFR failures
> gcc-4.2.4 : 0 MPFR failures
> gcc-4.3.0 : gcc 4.3.0 builds, but will not install for me.
> gcc-4.3.1 : 20 MPFR failures
> gcc-4.3.3 : 20 MPFR failures
> gcc-4.4.0 : 20 MPFR failures
>
> Paul, the mpfr build instructions say to download the latest mpfr
> patches using:
>
> wgethttp://www.mpfr.org/mpfr-2.4.1/patches
> patch -N -Z -p1 < patches
>
> or
>
> curlhttp://www.mpfr.org/mpfr-2.4.1/patches| patch -N -Z -p1
>
> Can you apply your fix so doing that will fix the problem? If so, I can
> produce an updated version for Sage which includes all fixes. Last time
> I checked, there were 5 of them. I did apply them to Sage, but it did
> not resolve any issues I was encountering.
>
> PS, you might want to make a note in the README that on Solaris, the GNU
> version of 'patch' at /usr/bin/gpatch must be used, as those
> instructions file if the Sun patch command is used.
>
> Dave
>
>
>
> [ Attached Message ]From:Paul Zimmermann <[email protected]>To:"Dr. 
> David Kirkby" <[email protected]>Cc:[email protected], 
> [email protected], 
> [email protected],[email protected]:Tue, 14 Jul 2009 
> 10:34:15 +0200Local:Tues 14 July 2009 09:34Subject:Re: [MPFR] Test failures 
> in mpfr - now I know why, and it is VERY ODD.       Hi,
>
> after all, I now believe this is a compiler failure, since the MPN_ZERO
> instruction is not passed to GMP, but it is converted into memset by
> mpfr-gmp.h. The documentation for memset does not forbid a zero size.
> However I was not able to reproduce the problem with the following
> simple program:
>
> #include <stdio.h>
> #include <string.h>
> #include "gmp.h"
> #define BYTES_PER_MP_LIMB 4
> #define MPN_ZERO(dst, n) memset((dst), 0, (n)*BYTES_PER_MP_LIMB)
> main(int argc, char *argv[])
> {
>   mp_limb_t a[1];
>   mp_size_t n = atoi(argv[1]);
>   a[0] = (mp_limb_t) 2684354560;
>   printf ("a[0]=%lu\n", a[0]);
>   MPN_ZERO(a,n-1);
>   printf ("a[0]=%lu\n", a[0]);
>
> }
>
> zimme...@t2:~$ ./a.out 1
> a[0]=2684354560
> a[0]=2684354560
>
> Some more investigation is needed.
>
> Paul
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to