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

Re: failure in new gcc testsuite test on i386-openbsd



FYI, 

Playing with this enabled me to find a sparc64 unsigned -> long double 
conversion problem, which is now fixed in -current. On sparc64, this 
regression test now succeeds. The i386 problem is still there.

	-Otto

On Fri, 17 Sep 2004, Otto Moerbeek wrote:

> I have norrowed it down a bit with the following program; it seems to have 
> something to do with the conversion being done runtime vs compile time. 
> Note that 18446744073709551615.0L is not representable, AFAIKS, and gets 
> converted to 18446744073709551616.0L
> 
> 	-Otto
> 
> 
> #include <stdio.h>
> int
> main()
> {
>   char *s;
>   unsigned long long int u = ~0ULL;
>   printf("%Lf\n", (long double) ~0ULL);
>   printf("%Lf\n", (long double) u);
>   printf("%Lf\n", 18446744073709551615.0L);
>   s = (u == 18446744073709551616.0L) ? "==" : "!=";
>   printf("1 %Lf %s %Lf\n", (long double)u, s,  18446744073709551616.0L);
>   s = (u == 18446744073709551615.0L) ? "==" : "!=";
>   printf("2 %Lf %s %Lf\n", (long double)u, s, 18446744073709551615.0L);
>   exit(0);
> }
> 
> results for i386 (note the difference when using -O2)
> [otto@pepper:138]$ cc x.c         
> [otto@pepper:139]$ ./a.out
> 18446744073709551616.000000
> 18446744073709551616.000000
> 18446744073709551616.000000
> 1 18446744073709551616.000000 == 18446744073709551616.000000
> 2 18446744073709551616.000000 != 18446744073709551616.000000
> [otto@pepper:140]$ cc -O2 x.c
> [otto@pepper:141]$ ./a.out    
> 18446744073709551616.000000
> 18446744073709551616.000000
> 18446744073709551616.000000
> 1 18446744073709551616.000000 != 18446744073709551616.000000
> 2 18446744073709551616.000000 == 18446744073709551616.000000
> [otto@pepper:142]$ 
> 
> results for macppc (looks OK)
> otto:2$ ./a.out                                                                
> 18446744073709551616.000000
> 18446744073709551616.000000
> 18446744073709551616.000000
> 1 18446744073709551616.000000 == 18446744073709551616.000000
> 2 18446744073709551616.000000 == 18446744073709551616.000000
> otto:3$ cc -O2 x.c
> otto:4$ ./a.out    
> 18446744073709551616.000000
> 18446744073709551616.000000
> 18446744073709551616.000000
> 1 18446744073709551616.000000 == 18446744073709551616.000000
> 2 18446744073709551616.000000 == 18446744073709551616.000000
> otto:5$ 
> 
> results for sparc64 (busted)
> [otto@iggy:1]$ cc x.c
> [otto@iggy:2]$ ./a.out                                                         
> 18446744073709551616.000000
> -1.000000
> 18446744073709551616.000000
> 1 -1.000000 != 18446744073709551616.000000
> 2 -1.000000 != 18446744073709551616.000000
> [otto@iggy:3]$ cc -O2 x.c
> [otto@iggy:4]$ ./a.out    
> 18446744073709551616.000000
> -1.000000
> 18446744073709551616.000000
> 1 -1.000000 != 18446744073709551616.000000
> 2 -1.000000 == -1.000000