From m.seaman@inpharmatica.co.uk Tue Jul 13 04:27:46 1999
Return-Path: <m.seaman@inpharmatica.co.uk>
Received: from gallions-reach.inpharmatica.co.uk (gallions-reach.inpharmatica.co.uk [193.115.214.5])
	by hub.freebsd.org (Postfix) with ESMTP id D763D152AD
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Jul 1999 04:27:42 -0700 (PDT)
	(envelope-from m.seaman@inpharmatica.co.uk)
Received: from kings-cross.inpharmatica.co.uk (euston.inpharmatica.co.uk [193.115.214.6])
	by gallions-reach.inpharmatica.co.uk (8.8.8/8.8.8) with ESMTP id LAA02031
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Jul 1999 11:27:40 GMT
	(envelope-from m.seaman@inpharmatica.co.uk)
Received: from b0.farm.inpharmatica.co.uk (b0.farm.inpharmatica.co.uk [192.168.124.110])
	by kings-cross.inpharmatica.co.uk (8.9.3/8.9.3) with ESMTP id MAA02633
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Jul 1999 12:27:40 +0100
Received: (from matthew@localhost)
	by b0.farm.inpharmatica.co.uk (8.9.3/8.9.3) id MAA09770;
	Tue, 13 Jul 1999 12:27:40 +0100 (BST)
	(envelope-from matthew@mailhost.inpharmatica.co.uk)
Message-Id: <199907131127.MAA09770@b0.farm.inpharmatica.co.uk>
Date: Tue, 13 Jul 1999 12:27:40 +0100 (BST)
From: m.seaman@inpharmatica.co.uk
To: FreeBSD-gnats-submit@freebsd.org
Subject: strtod(3) FPE on alphaev56  
X-Send-Pr-Version: 3.2

>Number:         12623
>Category:       alpha
>Synopsis:       Certain valid numeric strings cause a SIGFPE when attempting
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    robert
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 13 04:30:00 PDT 1999
>Closed-Date:    Sun Jul 13 12:43:27 PDT 2003
>Last-Modified:  Sun Jul 13 12:43:27 PDT 2003
>Originator:     Matthew Seaman
>Release:        FreeBSD 3.2-STABLE alpha
>Organization:
Inpharmatica Ltd
>Environment:

	b0:/tmp:% uname -a 
FreeBSD b0.farm.inpharmatica.co.uk 3.2-STABLE FreeBSD 3.2-STABLE #0: Thu Jul  8 09:04:16 BST 1999     matthew@b0.farm.inpharmatica.co.uk:/usr/src/sys/compile/FARM  alpha


>Description:

Attempting to convert the string "2.49521e-297" into a double
precision value via strtod(3) results in a floating point exception on
the alphaev56 CPU.  The problem doesn't occur on i586.

The problem is sensitive to both the mantissa and exponent of the
number: the following values are known to trigger the bug:

2.49521e-297
3.35554e-295
1.14662e-292
1.14e-293
2.495e-293
2.49e-294
2.4e-293
1e-305

whereas these do not:

2.4e-292
2.49521e-292
2.4951e-293
1.14e-292
1.15e-293

>How-To-Repeat:

#include <stdlib.h>

int
main (int argc, char *argv[])
{
  char str[32] = "2.49521e-297";
  double num;

  num = strtod (str, NULL);
}


>Fix:
	
not known




>Release-Note:
>Audit-Trail:

From: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
To: m.seaman@inpharmatica.co.uk
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, freebsd-alpha@freebsd.org
Subject: Re: alpha/12623: strtod(3) FPE on alphaev56
Date: Wed, 14 Jul 1999 01:06:37 +0900

 At Tue, 13 Jul 1999 12:27:40 +0100 (BST),
 m.seaman@inpharmatica.co.uk wrote:
 > >Description:
 > 
 > Attempting to convert the string "2.49521e-297" into a double
 > precision value via strtod(3) results in a floating point exception on
 > the alphaev56 CPU.  The problem doesn't occur on i586.
 
 /usr/src/lib/libc/stdlib/strtod.c seems broken on alpha in three ways.
 
 1) IEEE_8087 should be defined instead of IEEE_MC68k.
 
 2) It assumes long is 32bit, but long is 64bit on alpha.
 	s/unsigned long/u_int32_t/, s/long/int32_t/.
 
 3) It generates denormal numbers which can not be treaded by the hardware
    on alpha. It should be compiled with the option
    `-mtrap-precision=i -mfp-trap-mode=su' to enable software completion.
 
 -- 
 /\ Hidetoshi Shimokawa
 \/  simokawa@sat.t.u-tokyo.ac.jp
 PGP public key: finger -l simokawa@sat.t.u-tokyo.ac.jp
 
State-Changed-From-To: open->patched 
State-Changed-By: robert 
State-Changed-When: Sun Nov 17 08:49:15 PST 2002 
State-Changed-Why:  
A fix was committed to -CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12623 
Responsible-Changed-From-To: freebsd-alpha->robert 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sat Jul 12 16:34:28 PDT 2003 
Responsible-Changed-Why:  
Robert reported that a fix was committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12623 
State-Changed-From-To: patched->closed 
State-Changed-By: robert 
State-Changed-When: Sun Jul 13 12:41:04 PDT 2003 
State-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=12623 
>Unformatted:
 		 to convert to double 
