From owner-freebsd-standards@FreeBSD.ORG Sat Jan 30 18:11:51 2010 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B40B106566B; Sat, 30 Jan 2010 18:11:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id BED6E8FC0C; Sat, 30 Jan 2010 18:11:50 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o0UIBj0W071673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 30 Jan 2010 20:11:45 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id o0UIBjBK084343; Sat, 30 Jan 2010 20:11:45 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id o0UIBj6t084342; Sat, 30 Jan 2010 20:11:45 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 30 Jan 2010 20:11:45 +0200 From: Kostik Belousov To: Bruce Evans Message-ID: <20100130181145.GA3877@deviant.kiev.zoral.com.ua> References: <201001301251.o0UCpSEP077706@freefall.freebsd.org> <20100131014341.J78095@delplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lWZ9pouYHbrmKLtT" Content-Disposition: inline In-Reply-To: <20100131014341.J78095@delplex.bde.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: das@freebsd.org, gavin@freebsd.org, freebsd-standards@freebsd.org, freebsd-amd64@freebsd.org Subject: Re: standards/143358: nearbyint raises spurious inexact exception X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jan 2010 18:11:51 -0000 --lWZ9pouYHbrmKLtT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 31, 2010 at 02:20:30AM +1100, Bruce Evans wrote: > On Sat, 30 Jan 2010 gavin@freebsd.org wrote: >=20 > >Synopsis: nearbyint raises spurious inexact exception >=20 > >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=20 > >behaviour. >=20 > 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). >=20 > Removing fesetenv() in other contexts would give larger bugs. While looking at this, I tried to run the example on custom-build gcc 4.4.3/binutils 2.20 toolchain, and bumped into the issue fixed by http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3eac7944b4112632ad6= fb257c7ce31deda72d89f --lWZ9pouYHbrmKLtT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktkdmAACgkQC3+MBN1Mb4hasgCfZQ3GFXJIWUX++8mi6QjlfaMP czMAoMCz9Zw3TohtRMr8EkYKCpEH6F3J =ZL8P -----END PGP SIGNATURE----- --lWZ9pouYHbrmKLtT--