NetBSD Problem Report #34553

From  Mon Sep 18 17:33:39 2006
Return-Path: <>
Received: by (Postfix, from userid 31301)
	id 4BBD663BA82; Mon, 18 Sep 2006 17:33:39 +0000 (UTC)
Message-Id: <>
Date: Mon, 18 Sep 2006 17:33:39 +0000 (UTC)
Subject: gcc -msoft-float with long double doesn't duplicate hard-float
X-Send-Pr-Version: www-1.0

>Number:         34553
>Category:       toolchain
>Synopsis:       gcc -msoft-float with long double doesn't duplicate hard-float
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 18 17:35:00 +0000 2006
>Last-Modified:  Sat Sep 23 03:03:46 +0000 2006
>Originator:     Arthur Townsend
>Release:        3.0
3.0 for sun3, crosscompiled on NetBSD 3.0 i386, with MKSOFTFLOAT in /etc/mk.conf and --nfp added to /usr/src/tools gcc makefile.
when compiling with -msoft-float, floats work, and doubles work, but long doubles don't work (variables declared as long doubles and set to the same thing are shown as not equal).  The softfloat web-site: says that "SoftFloat's code for the extended double-precision and quadruple-precision formats depends on the existence of a 64-bit integer type in C. If the C compiler used to compile SoftFloat does not support 64-bit integers, SoftFloat will be limited to single and double precisions only." but gcc 3.3.3 for netbsd sun3 has "long long" for 64-bits, so I expect that long double would produce the same results as float/double.
The following code compiled with "gcc" doesn't print anything.  When compiled with "-msoft-float", it prints "NOT equal".  If "long double" is changed to float or double, then -msoft-float and regular hard-float compile produce identical results (no output).

#include <stdio.h>

int main()
long double a=1.1;
long double b=1.1;

 if (a != b) printf("NOT equal\n");



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; 

 printf("  f:%f\n",f); 
 printf(" d:%f\n",d); 

 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".  

Responsible-Changed-From-To: port-sun3-maintainer->toolchain-manager
Responsible-Changed-When: Sat, 23 Sep 2006 12:03:46 +0900
Not sun3 specific but toolchain issue.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.