I'm copying this to sage-devel@googlegroups.com too.

Paul Zimmermann wrote:
>        Hi,
> 
> I can now reproduce the 20 failures observed by David, with mpfr-2.4.1,
> configured with CC=/usr/local/gcc-4.4.0-sun-linker/bin/gcc.
> 
> The bug is due to the following MPFR line, in file mpn_exp.c:
> 
>   MPN_ZERO (a, n - 1);
> 
> When n=1, it "should" do nothing, but on this particular machine, GMP sets
> a[0] to zero. (Since MPN_ZERO is not documented in GMP, we cannot assume
> anything about its behaviour for length zero.) The fix is easy:
> 
> --- mpn_exp.c   (revision 6332)
> +++ mpn_exp.c   (working copy)
> @@ -71,7 +71,8 @@
>    /* allocate space for A and set it to B */
>    c = (mp_limb_t*) MPFR_TMP_ALLOC(2 * n * BYTES_PER_MP_LIMB);
>    a [n - 1] = B;
> -  MPN_ZERO (a, n - 1);
> +  if (n > 1)
> +    MPN_ZERO (a, n - 1);
>    /* initial exponent for A: invariant is A = {a, n} * 2^f */
>    f = h - (n - 1) * BITS_PER_MP_LIMB;
> 
> With that fix, all tests now pass:
> 
> ====================
> All 148 tests passed
> ====================
> 
> Thank you very much David for reporting that bug, and giving us the
> possibility to investigate on your machine.
> 
> Paul Zimmermann

Hi Paul,

It's great you have found a fix for this, though I suspect you are right 
in your later email when you say it may be a compiler bug. But if a 
change in mpfr can work around that compiler bug, it would be worth doing.

But of course, if you can find a test case which shows the compiler bug, 
it would be worth reporting it to

http://gcc.gnu.org/bugzilla/

more details at:

http://gcc.gnu.org/bugs.html

Is a new release of mpfr due out soon (i.e. under a week or two)? If 
not, one of us needs to create a patch for Sage. I have already opened a 
ticket for the bug, but so far there is no additional information.

http://sagetrac.org/sage_trac/ticket/6453

Dave

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to