Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2000 02:36:48 +0100
From:      Markus Holmberg <saska@acc.umu.se>
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>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000104023648.A43673>