From owner-freebsd-threads@FreeBSD.ORG Wed May 4 23:02:29 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A58F916A4CE; Wed, 4 May 2005 23:02:29 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E70443D3F; Wed, 4 May 2005 23:02:28 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 08D021F0C7; Thu, 5 May 2005 01:01:58 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id E205D6393; Thu, 5 May 2005 01:01:57 +0200 (CEST) Date: Thu, 5 May 2005 01:01:57 +0200 From: Marc Olzheim To: David Schultz Message-ID: <20050504230157.GA1886@stack.nl> References: <20050504205745.GH76171@stack.nl> <20050504221825.GA22732@VARK.MIT.EDU> <20050504223213.GA1799@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lMM8JwqTlfDpEaS6" Content-Disposition: inline In-Reply-To: <20050504223213.GA1799@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Daniel Eischen cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2005 23:02:29 -0000 --lMM8JwqTlfDpEaS6 Content-Type: multipart/mixed; boundary="NMuMz9nt05w80d4+" Content-Disposition: inline --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 05, 2005 at 12:32:13AM +0200, Marc Olzheim wrote: > That fixed it for me indeed. :-P I've applied the attached patch on my systems. Question remains why the truncf() doesn't trigger it and the ceilf() and floorf() does. And why it only triggers with threads (even a single thread is enough). Marc --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fpu.patch" Content-Transfer-Encoding: quoted-printable Index: lib/msun/i387/s_ceilf.S --- lib/msun/i387/s_ceilf.S.orig Thu Jan 13 19:58:25 2005 +++ lib/msun/i387/s_ceilf.S Thu May 5 00:54:18 2005 @@ -13,17 +13,17 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp); /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret Index: lib/msun/i387/s_floorf.S --- lib/msun/i387/s_floorf.S.orig Thu Jan 13 19:58:25 2005 +++ lib/msun/i387/s_floorf.S Thu May 5 00:54:29 2005 @@ -13,17 +13,17 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp); /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret Index: lib/msun/i387/s_truncf.S --- lib/msun/i387/s_truncf.S.orig Sat Apr 16 23:12:55 2005 +++ lib/msun/i387/s_truncf.S Thu May 5 00:54:35 2005 @@ -11,16 +11,16 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0c00,%dx /* round towards -oo */ - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp) /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret --NMuMz9nt05w80d4+-- --lMM8JwqTlfDpEaS6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeVRlezjnobFOgrERAttYAJ9wr4ZgSr1Ds7x8gX7aFznHWYn0VwCfTTdW 5TgxJyDbX5eRSvJGT7op4Y0= =wM0H -----END PGP SIGNATURE----- --lMM8JwqTlfDpEaS6--