From peterjeremy@optushome.com.au  Sat Apr 28 23:54:43 2007
Return-Path: <peterjeremy@optushome.com.au>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 46DDC16A401
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 28 Apr 2007 23:54:43 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from turion.vk2pj.dyndns.org (c220-239-3-125.belrs4.nsw.optusnet.com.au [220.239.3.125])
	by mx1.freebsd.org (Postfix) with ESMTP id B29F813C45A
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 28 Apr 2007 23:54:42 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from turion.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by turion.vk2pj.dyndns.org (8.13.8/8.13.8) with ESMTP id l3SNsfq2002489;
	Sun, 29 Apr 2007 09:54:41 +1000 (EST)
	(envelope-from peter@turion.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by turion.vk2pj.dyndns.org (8.13.8/8.13.8/Submit) id l3SNsflv002488;
	Sun, 29 Apr 2007 09:54:41 +1000 (EST)
	(envelope-from peter)
Message-Id: <200704282354.l3SNsflv002488@turion.vk2pj.dyndns.org>
Date: Sun, 29 Apr 2007 09:54:41 +1000 (EST)
From: Peter Jeremy <peterjeremy@optushome.com.au>
Reply-To: Peter Jeremy <peterjeremy@optushome.com.au>
To: FreeBSD-gnats-submit@freebsd.org
Subject: 32-bit libc incorrectly converts some FP numbers
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         112222
>Category:       amd64
>Synopsis:       [libc] 32-bit libc incorrectly converts some FP numbers
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 29 00:00:12 GMT 2007
>Closed-Date:    Thu Mar 25 18:06:16 UTC 2010
>Last-Modified:  Thu Mar 25 18:06:16 UTC 2010
>Originator:     Peter Jeremy
>Release:        FreeBSD 6.2-STABLE amd64
>Organization:
n/a
>Environment:
System: FreeBSD turion.vk2pj.dyndns.org 6.2-STABLE FreeBSD 6.2-STABLE #25: Tue Jan 30 05:01:57 EST 2007 root@turion.vk2pj.dyndns.org:/usr/obj/usr/src/sys/turion amd64

>Description:
	During testing of some 32-bit code on amd64, nonsense was printed
	for some floating point conversions, eg ':e+22' instead of 1e+23
	or ':e-07' instead of 1e-06.

	Further testing has localised the problem to dtoa(), though it is
	not yet clear whether the problem is in the source code, the
	compiler or the 32-bit cross-build part of buildworld.

	The problem only appears to affect numbers with a decimal fractional
	part of 1 and decimal exponents of -307, -298, -283, -280, -278, -277,
	-275, -274, -272, -271, -269, -268, -260, -258, -145, -96, -94, -93,
	-88, -85, -82, -81, -80, -77, -76, -75, -74, -72, -71, -69, -67, -66,
	-65, -64, -49, -40, -39, -36, -34, -29, -28, -24, -23, -20, -19, -16,
	-14, -12, -11, -7, -6, +23, +24, +28, +29, +31, +35, +36, +38, +40,
	+41, +42, +43, +46, +47, +48, +51, +52, +53, +55, +57, +59, +62, +65,
	+66, +67, +68, +72, +73, +74, +77, +78, +79, +80, +82, +85, +86, +87,
	+88, +89, +90, +94, +95, +96, +97, +98, +100, +103, +104, +108, +110,
	+113, +114, +115, +116, +117, +121, +122, +129, +130, +132, +133, +136,
	+137, +138, +139, +140, +141, +142, +143, +144, +145, +148, +149, +151,
	+152, +153, +154, +155, +172, +174, +178, +182, +190, +191, +192, +193,
	+198, +201, +205, +206, +207, +209, +216, +218, +221, +222, +223, +227,
	+230, +243, +244, +246, +252, +262, +263, +267, +268, +271, +273, +275,
	+277, +278, +283, +285, +288, +289, +290, +292, +294, +297, +299, +300,
	+301, +302, +303, +306.

	Linking against libc/gdtoa_dtoa.o compiled in an i386 environment
	does not show the problem.

>How-To-Repeat:
	echo 'main(){printf("%g %g %g\\n", 1e-24, 1e-7, 1e100);}' > x.c
	cc -m32 x.c
	./a.out

>Fix:
	Unknown.
>Release-Note:
>Audit-Trail:

From: Peter Jeremy <peterjeremy@optushome.com.au>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: amd64/112222: 32-bit libc incorrectly converts some FP numbers
Date: Sun, 29 Apr 2007 15:33:04 +1000

 --LQksG6bCIzRHxTLp
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On 2007-Apr-29 09:54:41 +1000, Peter Jeremy <peterjeremy@optushome.com.au> =
 wrote:
 >	Further testing has localised the problem to dtoa(), though it is
 >	not yet clear whether the problem is in the source code, the
 >	compiler or the 32-bit cross-build part of buildworld.
 
 I've narrowed the problem down to the -msse2 that is in the version
 of Makefile.inc1 that I have.  I notice that this flag was removed
 in Makefile.inc1 v1.499.2.18.  Some manual experimenting with the
 CFLAGS implied by that Makefile suggests that the problem goes away
 with the newer Makefile.inc1.
 
 I will upgrade world and retry.
 
 --=20
 Peter Jeremy
 
 --LQksG6bCIzRHxTLp
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (FreeBSD)
 
 iD8DBQFGNC4Q/opHv/APuIcRAsGmAKCQO6+YlDHNo43OHKPN9dvQNLFKTwCgsNlp
 xpcOjKfGyZWOwbm6kJDIc/E=
 =79L8
 -----END PGP SIGNATURE-----
 
 --LQksG6bCIzRHxTLp--

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@freebsd.org,  peterjeremy@optushome.com.au
Cc:  
Subject: Re: amd64/112222: [libc] 32-bit libc incorrectly converts some FP
 numbers
Date: Wed, 17 Oct 2007 19:10:20 +0100

 I tried to replicate this on my amd64 system running 7-PRERELEASE and 
 gcc 4.2.1 but got the expected result.  Is this PR still an issue?
 
 --
 Bruce Cran

From: bruce@cran.org.uk
To: bug-followup@FreeBSD.org, peterjeremy@optushome.com.au
Cc:  
Subject: Re: amd64/112222: [libc] 32-bit libc incorrectly converts some FP numbers
Date: Tue, 23 Oct 2007 12:30:38 +0100

 Is this a duplicate of kern/102424?
 
 --
 Bruce Cran

Adding to audit trail from misfiled PR amd64/118240:

Date: Sun, 25 Nov 2007 01:05:20 +0000
From: Bruce Cran <bruce@cran.org.uk>
 
 This issue does still exist on 6.3-PRELEASE with sources from 24th 
 November.    The issue only occurs when libc is compiled with -O2, since 
 the problem appears to be due to gcse - adding -fno-gcse prevents the 
 problem.  Without CFLAGS defined in /etc/make.conf libc gets compiled 
 with -O2 and so the issue will occur in a standard 6.3 build.    
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28096 looks like a fairly 
 similar issue, albeit in gcc 4.x.
 
 --
 Bruce

From: Alexander Best <alexbestms@wwu.de>
To: <bug-followup@FreeBSD.org>
Cc: Bruce Cran <bruce@cran.org.uk>
Subject: Re: amd64/112222: [libc] 32-bit libc incorrectly converts some FP
 numbers
Date: Thu, 25 Mar 2010 18:29:02 +0100 (CET)

 if this issue has indeed been fixed by gcc commit r117331
 (http://gcc.gnu.org/viewcvs?view=revision&revision=117331) the only branch it
 still applies to is stable/6.
 
 since it is very unlikely that a committer will backport these changes to gcc
 3.4.6 the pr should be closed.
 
 -- 
 Alexander Best
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Thu Mar 25 18:06:15 UTC 2010 
State-Changed-Why:  
This had been resolved in all branches (head/8/7) and can no longer be 
reproduced. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112222 
>Unformatted:
