Subject: Re: port-sun3/34553
To: None <port-sun3-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <SigmFSK@aol.com>
List: netbsd-bugs
Date: 09/20/2006 19:50:02
The following reply was made to PR port-sun3/34553; it has been noted by GNATS.

From: SigmFSK@aol.com
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-sun3/34553  
Date: Wed, 20 Sep 2006 15:45:59 EDT

 GCC (when built with --nfp -msoft-float) also  can't be trusted for correct 
 operation when using it to compile without  -msoft-float. 
 
 For example, the following code, compiled with "gcc -S"  generates the same 
 assembly code (with hardware floating point calls) when  compiled either with 
 either GCC built without -msoft-float, or GCC built with  -msoft-float. 
 
 But when the assembly is linked and run, it runs correctly  with GCC built 
 without -msoft-float, but with a GCC built with -msoft-float, it  generates 
 incorrect output.  GCC built without -msoft-float shows 123.456  for all types, 
 but GCC built with -msoft-float prints 126.976 for the long  double.  Since the 
 entire assembly uses hardware floating point calls  (fmove.x), it must be the 
 printf routine inside GCC that is broken.  
 
 #include <stdio.h> 
 
 float f = 123.456; 
 double d =  123.456; 
 long double ld = 123.456; 
 
 main() 
 { 
 printf("  f:%f\n",f); 
 printf(" d:%f\n",d); 
 printf("ld:%.4Lf\n",ld);  
 } 
 
 Also, GCC (built with -msoft-float) when printing, as above, a  long double 
 with a value of infinity, shows "nan", whereas GCC built without  -msoft-float 
 shows "inf".