NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/45310: some mixed int/float computations are wrong on mips64



On Mon, Aug 29, 2011 at 09:55:00PM +0000, Manuel.Bouyer%lip6.fr@localhost wrote:
> >Description:
>       I first noticed that ftp(1) and progress(1) reported speeds of 0b/s.
>       I tracked it down to ptransfer() in ftp and finally ended up with this
>       test program:
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> 
> main()
> {
>       float a;
>       off_t b;
> 
>       a = 0.544355;
>       b = 4866695;
> 
>       printf("a %f b %d\n",a, (int)b);
>       b /= a;
>       printf("now b %d\n", (int)b);
> }
>       On i386 this gives:
> a 0.544355 b 4866695
> now b 8940297
>       on mips64el:
> a 0.544355 b 4866695
> now b 0

Here's a second test that could allow to narrow down the issue:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

main()
{
        float a;
        int64_t b;

        a = 33.000000;
        b = a;

        printf("a %f b %d\n",a, (int)b);
}

cuba:/home/bouyer>./test3
a 33.000000 b 0

looks like the problem could be in __fixsfdi() (or one of the functions used by
__fixsfdi()).
When compiled -O2 the above test shows the expected result, but then the
compiler does the float -> int64_t conversion at compile time.

Replacing the int64_t with uint64_t results in a core dump.
I can't get more details because of PR port-mips/45309

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index