Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2000 05:51:38 +0100
From:      Markus Holmberg <saska@acc.umu.se>
To:        "Ronald F. Guilmette" <rfg@monkeys.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Should -mieee-fp equal fpsetmask(0) to avoid SIGFPE on FreeBSD?
Message-ID:  <20000105055138.A74746@fysgr387.sn.umu.se>
In-Reply-To: <87632.947017515@monkeys.com>; from rfg@monkeys.com on Tue, Jan 04, 2000 at 12:25:15PM -0800
References:  <20000104121459.A8959@cons.org> <87632.947017515@monkeys.com>

next in thread | previous in thread | raw e-mail | index | archive | help
To my understanding, there isn't a flaw in the Mozilla code. What is
happening is that a cast is made to test if a value inside a double
actually is just an int! If it wasn't, no harm is done and the double
will be continued to be treaten as a double.

That's is how I've interpreted it. To see where the macro in question
(that generates the SIGFPE's) is defined and used, check this link:

http://lxr.mozilla.org/seamonkey/ident?i=JSDOUBLE_IS_INT

Here's the definition:

#define JSDOUBLE_IS_INT(d, i) (JSDOUBLE_IS_FINITE(d) && \
	!JSDOUBLE_IS_NEGZERO(d) && ((d) == (i = (jsint)(d))))

(Taken from http://lxr.mozilla.org/seamonkey/source/js/src/jsnum.h#82 )

I'm not 100% sure this is the only place where this happens, but it
seems to be the most frequent. If it actually is the case that the cast
is made just for testing purposes, then there isn't any flaw in the code
and the SIGFPE (here) just needs to be turned off?

I hope someone will object if this is not the case. (Or confirm that
it's ok :))

/Markus


On Tue, Jan 04, 2000 at 12:25:15PM -0800, Ronald F. Guilmette wrote:
> 
> In message <20000104121459.A8959@cons.org>, 
> Martin Cracauer <cracauer@cons.org> wrote:
> 
> >Hence it is good to trap this and it is a bug in Mozilla, period.
> >...
> >I think we might discuss lowing the traps so that the softer
> >exceptions are disabled. But most cases where people cry about
> >FreeBSD's behaviour are serious errors like the one in mozilla, so we
> >won't gain much.
> 
> I agree that it appears that the Mozilla code had a serious bug/flaw,
> and that having the FP traps enabled caused that fact to become
> apparent.
> 
> But the issue for me is still one of standards conformance.  Regardless of
> how helpful enabled FP traps may be, on occasion, for certain programs
> and/or certain programmers, the IEEE 754 standard is pretty darn clear
> and unambiguous regarding what the default setting should be, i.e. all
> traps disabled.
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 

-- 

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?20000105055138.A74746>