standards/143358: [libm] nearbyint(3) raises spurious inexact
exception
Alexander Best
arundel at freebsd.org
Tue Nov 23 23:50:11 UTC 2010
The following reply was made to PR standards/143358; it has been noted by GNATS.
From: Alexander Best <arundel at freebsd.org>
To: bug-followup at freebsd.org
Cc:
Subject: Re: standards/143358: [libm] nearbyint(3) raises spurious inexact exception
Date: Tue, 23 Nov 2010 23:42:05 +0000
this is what bruce evans wrote concerning this issue.
cheers.
alex
----- Forwarded message from Bruce Evans <brde at optusnet.com.au> -----
Date: Tue, 16 Nov 2010 06:01:06 +1100 (EST)
From: Bruce Evans <brde at optusnet.com.au>
To: Alexander Best <arundel at FreeBSD.org>
cc: Bruce Evans <brde at optusnet.com.au>, Ulrich Spoerlein <uqs at FreeBSD.org>,
das at FreeBSD.org
Subject: Re: svn commit: r215237 - head/lib/msun/src
[Cc trimmed]
On Mon, 15 Nov 2010, Alexander Best wrote:
>if you are interested in solving two more msun mysteries, you might want to
>have a look at #PR kern/133583 and standards/143358.
I had already debugged #143358. The mail wasn't sent to gnats.
%%%
>From bde at optusnet.com.au Sun Jan 31 02:20:33 2010 +1100
Date: Sun, 31 Jan 2010 02:20:30 +1100 (EST)
From: Bruce Evans <brde at optusnet.com.au>
X-X-Sender: bde at delplex.bde.org
To: gavin at freebsd.org
cc: freebsd-amd64 at freebsd.org, freebsd-standards at freebsd.org, das at freebsd.org
Subject: Re: standards/143358: nearbyint raises spurious inexact exception
In-Reply-To: <201001301251.o0UCpSEP077706 at freefall.freebsd.org>
Message-ID: <20100131014341.J78095 at delplex.bde.org>
References: <201001301251.o0UCpSEP077706 at freefall.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Status: O
X-Status:
X-Keywords:
X-UID: 1287
On Sat, 30 Jan 2010 gavin at freebsd.org wrote:
>Synopsis: nearbyint raises spurious inexact exception
>Note that a comment in the function itself in lib/msun/src/s_nearbyint.c
>does also suggest that this PR is valid, "We save and restore the
>floating-point environment to avoid raising an inexact exception." I've
>also verified Solaris 10, Linux and FreeBSD 7.2 show the expected behaviour.
This seems to be a bug in gcc-4.2, or perhaps a bug in the inline asms.
gcc-4.2 still works with -O0, but with -O it removes the entire fesetenv()
in nearbyint(). The fegetenv() isn't removed though its result is never
used. I didn't get anywhere good trying to fix this, but I got to the
following worse place of interest: after replacing the fesetenv(&env) by
fesetenv(&xenv) where xenv is an invalidly initialized global variable
(all 0's), the fegetenv(&env) corrupted the current environment (looks
a bit like xenv was used to initialize the current environment).
Removing fesetenv() in other contexts would give larger bugs.
Bruce
%%%
Note that it is the libary that must be compiled with -O0 to avoid this
bug.
Bruce
----- End forwarded message -----
--
a13x
More information about the freebsd-standards
mailing list