NetBSD Problem Report #33262
From www@netbsd.org Sat Apr 15 15:15:48 2006
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
id 6513F63B8A7; Sat, 15 Apr 2006 15:15:48 +0000 (UTC)
Message-Id: <20060415151548.6513F63B8A7@narn.netbsd.org>
Date: Sat, 15 Apr 2006 15:15:48 +0000 (UTC)
From: tnozaki@netbsd.org
Reply-To: tnozaki@netbsd.org
To: gnats-bugs@netbsd.org
Subject: isinf(strtold("INF", NULL)) returns false
X-Send-Pr-Version: www-1.0
>Number: 33262
>Category: lib
>Synopsis: isinf(strtold("INF", NULL)) returns false
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Apr 15 15:20:00 +0000 2006
>Closed-Date: Tue Apr 12 02:50:50 +0000 2011
>Last-Modified: Tue Apr 12 02:55:01 +0000 2011
>Originator: Takehiko NOZAKI
>Release: NetBSD i386 3.99.17
>Organization:
>Environment:
NetBSD krafty.example.jp 3.99.17 NetBSD 3.99.17 (KRAFTY) #0: Sun Apr 9 04:03:45 JST 2006 tnozaki@krafty.example.jp:/usr/obj/sys/arch/i386/compile/KRAFTY i386
libc.so.12.139
>Description:
strtold("INF", NULL) should return HUGE_VALL,
and isinf(strtold("INF", NULL)) should return true.
but NetBSD/i386's implementation(= gdtoa) is not.
(i don't know whether other architecture has same problems too)
it seems that HUGE_VALL definition are different
between
src/lib/libc/gdtoa/strtopx.c
(snip)
case STRTOG_Infinite:
L[_0] = 0x7fff;
L[_1] = L[_2] = L[_3] = L[_4] = 0;
and src/lib/libc/arch/i386/gen/infinityl.c.
(snip)
const union __long_double_u __infinityl =
{ { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 } };
>How-To-Repeat:
#include <assert.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
assert(isinf(strtold("INF", NULL)));
}
----------------------------------------
assertion "isinf(strtold("INF", NULL))" failed file "strtold_test.c", line 5, function "main"
Abort (core dumped)
>Fix:
for only i386 architecture, apply this patch.
(i'm not sure this is correct way...)
Index: strtopx.c
===================================================================
RCS file: /cvsroot/src/lib/libc/gdtoa/strtopx.c,v
retrieving revision 1.3
diff -u -B -w -r1.3 strtopx.c
--- strtopx.c 15 Mar 2006 17:35:18 -0000 1.3
+++ strtopx.c 14 Apr 2006 13:08:44 -0000
@@ -89,7 +89,8 @@
case STRTOG_Infinite:
L[_0] = 0x7fff;
- L[_1] = L[_2] = L[_3] = L[_4] = 0;
+ L[_1] = 0x8000;
+ L[_2] = L[_3] = L[_4] = 0;
break;
case STRTOG_NaN:
>Release-Note:
>Audit-Trail:
From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/33262 CVS commit: src/tests/lib/libc/stdlib
Date: Wed, 6 Apr 2011 07:25:35 +0000
Module Name: src
Committed By: jruoho
Date: Wed Apr 6 07:25:34 UTC 2011
Modified Files:
src/tests/lib/libc/stdlib: t_strtod.c
Log Message:
Verify the existence of PR lib/33262.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_strtod.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Jukka Ruohonen <jruohonen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: lib/33262
Date: Sun, 10 Apr 2011 07:42:15 +0300
Here is a summary collected from the automated tests:
Fails on: amd64
Does not fail on: i386, sparc64, macppc, alpha
The amd64 failure is reproduced also on "native", non-QEMU, host.
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: christos@NetBSD.org
Subject: Re: lib/33262
Date: Sun, 10 Apr 2011 15:20:40 +0200
I have two suggestion to fix this mess:
- Make gdtoa use __infinityl directly
This makes sure we use the same value on every arch
- Clean up all inconsistencies in lib/libc/arch/*/gen/infinityl.c
Christos fixed i386 in rev 1.3 but m68k and amd64 still use the
variant with an additional bit set (according to a quick grep).
Christos, what do you think?
Martin
From: christos@zoulas.com (Christos Zoulas)
To: Martin Husemann <martin@duskware.de>, gnats-bugs@NetBSD.org
Cc:
Subject: Re: lib/33262
Date: Sun, 10 Apr 2011 09:40:48 -0400
On Apr 10, 3:20pm, martin@duskware.de (Martin Husemann) wrote:
-- Subject: Re: lib/33262
| I have two suggestion to fix this mess:
|
| - Make gdtoa use __infinityl directly
| This makes sure we use the same value on every arch
|
| - Clean up all inconsistencies in lib/libc/arch/*/gen/infinityl.c
| Christos fixed i386 in rev 1.3 but m68k and amd64 still use the
| variant with an additional bit set (according to a quick grep).
|
| Christos, what do you think?
I would go for [2] Cleanup... because at this point I don't want to
create more diffs to gdtoa.
christos
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: lib/33262
Date: Mon, 11 Apr 2011 10:52:27 +0200
Christos fixed amd64 already, and the m68k version of __isinfl() explicitly
allows both variants for infinity representation - I think we can call
this fixed.
Martin
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/33262 CVS commit: src/tests/lib/libm
Date: Mon, 11 Apr 2011 10:51:37 +0000
Module Name: src
Committed By: martin
Date: Mon Apr 11 10:51:37 UTC 2011
Modified Files:
src/tests/lib/libm: Makefile
Added Files:
src/tests/lib/libm: t_infinity.c
Log Message:
Try to generate infinite values in all available floating point formats
on the FPU and check isinf() and fpclassify() results. This is
different from the libc internal consistency checks testing PR
lib/33262.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libm/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_infinity.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Tue, 12 Apr 2011 02:50:50 +0000
State-Changed-Why:
Should be fixed.
From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/33262 CVS commit: src/tests/lib/libc/stdlib
Date: Tue, 12 Apr 2011 02:52:20 +0000
Module Name: src
Committed By: jruoho
Date: Tue Apr 12 02:52:20 UTC 2011
Modified Files:
src/tests/lib/libc/stdlib: t_strtod.c
Log Message:
PR lib/33262 should be fixed; remove expected failure.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/stdlib/t_strtod.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.