From owner-freebsd-hackers Mon Jan 3 17:34:31 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from fysgr387.sn.umu.se (fysgr387.sn.umu.se [130.239.128.239]) by hub.freebsd.org (Postfix) with ESMTP id 845D41504F for ; Mon, 3 Jan 2000 17:34:24 -0800 (PST) (envelope-from saska@fysgr387.sn.umu.se) Received: by fysgr387.sn.umu.se (Postfix, from userid 1000) id 23836A837; Tue, 4 Jan 2000 02:36:48 +0100 (CET) Date: Tue, 4 Jan 2000 02:36:48 +0100 From: Markus Holmberg To: freebsd-hackers@freebsd.org Subject: Should -mieee-fp equal fpsetmask(0) to avoid SIGFPE on FreeBSD? Message-ID: <20000104023648.A43673@fysgr387.sn.umu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG After browsing the archives of this list searching for information on SIGFPE issues in FreeBSD I believe I have learnt the following: From: http://www.FreeBSD.org/cgi/getmsg.cgi?fetch=903527+906405+/usr/local/www/db/text/1999/freebsd-hackers/19991226.freebsd-hackers IEEE Std 754-1985 (Section 7, paragraph 1) is: ``The default response to an exception shall be to proceed without a trap.'' (end quote) When checking with a simple C program and fpgetmask() I can confirm that a couple of bits are set by default, which mean they will trap some floating point operations. This is consistent with the older postings that say that default FreeBSD behaviour is *not* conforming with IEEE floating point standards. But when porting software from other platforms this becomes an issue. To my understanding, doing a fpsetmask(0) makes FreeBSD behave conforming to IEEE (i.e. not trapping the exceptions). Question 1: What is the reason for FreeBSD to differ from other platforms and not follow the IEEE standard by default? (Please forgive me if this is an ignorant question.) To avoid cluttering the code with fpsetmask(0)'s, using a compiler option to force IEEE conforming fp behaviour would be desirable. This is where the -mieee-fp parameter for gcc would be handy! Even though compiling with -mieee-fp option, fpgetmask() still returns the mask with several bits set (when I was expecting them all to be turned off). Also two binaries compiled with -mieee-fp and -mno-ieee-fp respectively turn out to be identical (i.e. the flags have no effect). Question 2: Is -mieee-fp option in gcc broken in FreeBSD? Or have I missed something.. In that case I apologize for ignorance and hope someone don't mind clarifying these matters. The direct reason for me asking about this is a FreeBSD-specific bug in Mozilla (that needs help from someone who knows this): http://bugzilla.mozilla.org/show_bug.cgi?id=9967 Feel free to check it out. /Markus -- Markus Holmberg | Give me UNIX or give me a typewriter. saska@acc.umu.se | http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message