#include <stdio.h>
#include "mpir.h"
#include "gmp-impl.h"
#include "longlong.h"
int main(void)
{mp_size_t j,n=1;
mp_limb_t r=0,s=0,h,l,q,i,qp[2],xp[2],d;
d=0x80000000;
xp[0]=0x91234567;
count_leading_zeros(s,d);
d=d<<s;
invert_limb(i,d);
for(j=n-1;j>=0;j--)//j=0;//replace for loop with this to stop compiler error
{l=xp[j];
h=(l>>((GMP_LIMB_BITS-1-s))>>1);l=l<<s;
h=h+r;
udiv_qrnnd_preinv(q,r,h,l,d,i);
qp[j]=q;
}
r>>=s;
printf("%lu %lu\n",qp[0],r);
if( r+qp[0]*d != xp[0] ) printf("ERROR in calc \n");
return 0;}
-bash-3.00$ cc -O1 jason.c -o
jason -I /home/jasonmoxham/mpir/mpir/trunk/ -I . -L .libs/ -lmpir && ./jason
1 287524199
-bash-3.00$ cc -O2 jason.c -o
jason -I /home/jasonmoxham/mpir/mpir/trunk/ -I . -L .libs/ -lmpir && ./jason
2722532047 2435007847
ERROR in calc
So it's a compiler error
On Sunday 31 May 2009 15:01:53 Bill Hart wrote:
> Ah, yes of course. The OS/machine combination selects the optimisation
> values, which are often dialed back because of miscompilations. If
> that does fix it, I would suggest the ticket is probably invalid.
>
I'll try that now
> Try testing is a good idea. This week I'll also write a small program
> to do more serious testing of the new toom code and the new FFT.
> Neither try nor make check is sufficient to be totally sure, really,
> though by selective use of try I was able to convince myself the code
> was solid.
>
> Bill.
>
> 2009/5/31 Jason Moxham <[email protected]>:
> > On Sunday 31 May 2009 14:41:23 Bill Hart wrote:
> >> OK, I see the ticket, and I think that is sufficient for now. We'll
> >> fix it during the week if we can.
> >
> > I think -O1 will fix it , I'll run a test and in the next hour have the
> > result.
> >
> > I'll give --build=none-sun-solaris2.10 a go as well , perhaps for a
> > generic C build we may need to specify the OS in general.
> >
> >> Is that the last of the issues on SkyNet?
> >
> > Yeah.
> >
> > We need to do some try testing for the new asm code
> >
> >> Note I did not yet remove the extra HAVE_NATIVE_blah's that you found
> >> in my Toom code. But I think it is safer, given that so much testing
> >> has already happened, that I also make a ticket for that and we'll fix
> >> that in a service release. I'll make an MPIR 1.2.1 target in trac and
> >> assign it to that as a blocker.
> >>
> >> Bill.
> >>
> >> 2009/5/31 Jason Moxham <[email protected]>:
> >> > The error is also in mpir-1.1 on mark with
> >> > export CC=cc && ./configure --build=none && make -j 2 && make -j 2
> >> > check
> >> >
> >> > On Sunday 31 May 2009 13:33:24 Bill Hart wrote:
> >> >> Unfortunately they are the only sun machines with that architecture
> >> >> we have access to.
> >> >>
> >> >> At any rate, let's try mpir-1.1. If it is there, I guess we make a
> >> >> ticket and fix it later this week, if it isn't a compiler bug. I'm
> >> >> sure it is harmless given that the tests pass under an ordinary
> >> >> build.
> >> >>
> >> >> Bill.
> >> >>
> >> >> 2009/5/31 Jason Moxham <[email protected]>:
> >> >> > If the machines were faster I would , I suspect it the error is
> >> >> > when we configure with build=none and only in
> >> >> > mpn_divrem_euclidean_q?_1.c when we build with Sun's cc
> >> >> >
> >> >> > On Sunday 31 May 2009 13:24:01 Bill Hart wrote:
> >> >> >> That seems wise. In fact, I wonder if this error was in the
> >> >> >> original GMP. It might be worth running the same test for GMP. At
> >> >> >> least we could exclude that this has been there all along.
> >> >> >>
> >> >> >> Bill.
> >> >> >>
> >> >> >> 2009/5/31 Jason Moxham <[email protected]>:
> >> >> >> > This error should also be in mpir-1.1
> >> >> >> > I'll run a test for it on mark , I'll use mark2 for my testing ,
> >> >> >> > they are so SLOW
> >> >> >> >
> >> >> >> > On Sunday 31 May 2009 13:07:09 Bill Hart wrote:
> >> >> >> >> If you are *sure* it is a miscompilation, let's make a ticket
> >> >> >> >> for it. We also need to understand if this can ever affect a
> >> >> >> >> real user, assuming we had users who like to use the Sun
> >> >> >> >> compiler, or is this something that can only affect them if
> >> >> >> >> they select build=none, which I doubt a real user would do.
> >> >> >> >>
> >> >> >> >> If only the latter, then this needn't block an alpha release,
> >> >> >> >> though we should fix it over the next week before final or in a
> >> >> >> >> service release.
> >> >> >> >>
> >> >> >> >> Bill.
> >> >> >> >>
> >> >> >> >> 2009/5/31 Jason Moxham <[email protected]>:
> >> >> >> >> > The file is divrem_euclidean_qr_1 , and it looks like cc is
> >> >> >> >> > compiling it wrong when we select --build=none
> >> >> >> >> >
> >> >> >> >> > it passed with these configure options except the last with
> >> >> >> >> > cc and CC #standard build
> >> >> >> >> > build $C $CX ""
> >> >> >> >> > # all features
> >> >> >> >> > build $C $CX "--enable-cxx --enable-gmpcompat"
> >> >> >> >> > # all features and debug
> >> >> >> >> > build $C
> >> >> >> >> > $CX "--enable-cxx --enable-gmpcompat --enable-assert
> >> >> >> >> > --enable-alloca=debug" # maximum debug
> >> >> >> >> > build $C
> >> >> >> >> > $CX "--enable-cxx --enable-gmpcompat --enable-assert
> >> >> >> >> > --enable-alloca=debug --build=none"
> >> >> >> >> >
> >> >> >> >> > and it passes everthing with gcc and gcc-4.3.3
> >> >> >> >> >
> >> >> >> >> > I just corrected an error that would of kicked in at 2^31
> >> >> >> >> > limbs in divrem_euclidean_1.c
> >> >> >> >> >
> >> >> >> >> > On Sunday 31 May 2009 12:41:30 Jason Moxham wrote:
> >> >> >> >> >> using cc and CC on mark or mark2
> >> >> >> >> >> configure --enable-cxx --enable-gmpcompat --enable-assert
> >> >> >> >> >> --enable-alloca=debug --build=none
> >> >> >> >> >>
> >> >> >> >> >> make[4]: Entering directory `/tmp/mark2/tests/mpz'
> >> >> >> >> >> PASS: t-addsub
> >> >> >> >> >> PASS: t-cmp
> >> >> >> >> >> PASS: t-mul
> >> >> >> >> >> PASS: t-mul_i
> >> >> >> >> >> PASS: t-tdiv
> >> >> >> >> >> ERROR: remainders from mpz_tdiv_qr_ui and mpz_tdiv_r_ui
> >> >> >> >> >> differ dividend = 4B3
> >> >> >> >> >> divisor = FFE00078
> >> >> >> >> >> /bin/bash: line 4: 5999 Abort (core
> >> >> >> >> >> dumped) ${dir}$tst FAIL: t-tdiv_ui
> >> >> >> >> >> PASS: t-fdiv
> >> >> >> >> >> ERROR: remainders from mpz_fdiv_qr_ui and mpz_fdiv_r_ui
> >> >> >> >> >> differ dividend = 4B3
> >> >> >> >> >> divisor = FFE00078
> >> >> >> >> >> /bin/bash: line 4: 6007 Abort (core
> >> >> >> >> >> dumped) ${dir}$tst FAIL: t-fdiv_ui
> >> >> >> >> >> ERROR: remainders from mpz_cdiv_qr_ui and mpz_cdiv_r_ui
> >> >> >> >> >> differ dividend = 4B3
> >> >> >> >> >> divisor = FFE00078
> >> >> >> >> >> /bin/bash: line 4: 6012 Abort (core
> >> >> >> >> >> dumped) ${dir}$tst FAIL: t-cdiv_ui
> >> >> >> >> >> PASS: t-gcd
> >> >> >> >> >> PASS: t-gcd_ui
> >> >> >> >> >> PASS: t-lcm
> >> >> >> >> >> PASS: dive
> >> >> >> >> >> PASS: dive_ui
> >> >> >> >> >> PASS: t-sqrtrem
> >> >> >> >> >> PASS: convert
> >> >> >> >> >> PASS: io
> >> >> >> >> >> PASS: t-inp_str
> >> >> >> >> >> PASS: logic
> >> >> >> >> >> PASS: bit
> >> >> >> >> >> PASS: t-powm
> >> >> >> >> >> PASS: t-powm_ui
> >> >> >> >> >> PASS: t-pow
> >> >> >> >> >> PASS: t-div_2exp
> >> >> >> >> >> PASS: reuse
> >> >> >> >> >> PASS: t-root
> >> >> >> >> >> PASS: t-perfsqr
> >> >> >> >> >> PASS: t-jac
> >> >> >> >> >> PASS: t-bin
> >> >> >> >> >> PASS: t-get_d
> >> >> >> >> >> PASS: t-get_d_2exp
> >> >> >> >> >> PASS: t-get_si
> >> >> >> >> >> PASS: t-set_d
> >> >> >> >> >> PASS: t-set_si
> >> >> >> >> >> PASS: t-fac_ui
> >> >> >> >> >> PASS: t-fib_ui
> >> >> >> >> >> PASS: t-lucnum_ui
> >> >> >> >> >> PASS: t-scan
> >> >> >> >> >> PASS: t-fits
> >> >> >> >> >> PASS: t-divis
> >> >> >> >> >> PASS: t-divis_2exp
> >> >> >> >> >> PASS: t-cong
> >> >> >> >> >> PASS: t-cong_2exp
> >> >> >> >> >> PASS: t-sizeinbase
> >> >> >> >> >> PASS: t-set_str
> >> >> >> >> >> PASS: t-aorsmul
> >> >> >> >> >> PASS: t-cmp_d
> >> >> >> >> >> PASS: t-cmp_si
> >> >> >> >> >> PASS: t-hamdist
> >> >> >> >> >> PASS: t-oddeven
> >> >> >> >> >> PASS: t-popcount
> >> >> >> >> >> PASS: t-set_f
> >> >> >> >> >> PASS: t-io_raw
> >> >> >> >> >> PASS: t-import
> >> >> >> >> >> PASS: t-export
> >> >> >> >> >> PASS: t-pprime_p
> >> >> >> >> >> PASS: t-perfpow
> >> >> >> >> >> ============================================================
> >> >> >> >> >>= 3 of 57 tests failed
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> This looks like a compiler error , or a real one
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"mpir-devel" group.
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/mpir-devel?hl=en
-~----------~----~----~----~------~----~------~--~---