Date: Tue, 23 Nov 2010 23:50:11 GMT From: Alexander Best <arundel@freebsd.org> To: freebsd-standards@FreeBSD.org Subject: Re: standards/143358: [libm] nearbyint(3) raises spurious inexact exception Message-ID: <201011232350.oANNoBZC073398@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR standards/143358; it has been noted by GNATS.
From: Alexander Best <arundel@freebsd.org>
To: bug-followup@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@optusnet.com.au> -----
Date: Tue, 16 Nov 2010 06:01:06 +1100 (EST)
From: Bruce Evans <brde@optusnet.com.au>
To: Alexander Best <arundel@FreeBSD.org>
cc: Bruce Evans <brde@optusnet.com.au>, Ulrich Spoerlein <uqs@FreeBSD.org>,
das@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@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@optusnet.com.au>
X-X-Sender: bde@delplex.bde.org
To: gavin@freebsd.org
cc: freebsd-amd64@freebsd.org, freebsd-standards@freebsd.org, das@freebsd.org
Subject: Re: standards/143358: nearbyint raises spurious inexact exception
In-Reply-To: <201001301251.o0UCpSEP077706@freefall.freebsd.org>
Message-ID: <20100131014341.J78095@delplex.bde.org>
References: <201001301251.o0UCpSEP077706@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@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
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011232350.oANNoBZC073398>
