From owner-freebsd-hackers Tue Jan 4 20:49: 3 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 D8F4814E7E for ; Tue, 4 Jan 2000 20:48:58 -0800 (PST) (envelope-from saska@fysgr387.sn.umu.se) Received: by fysgr387.sn.umu.se (Postfix, from userid 1000) id 158CEA837; Wed, 5 Jan 2000 05:51:39 +0100 (CET) Date: Wed, 5 Jan 2000 05:51:38 +0100 From: Markus Holmberg To: "Ronald F. Guilmette" 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> References: <20000104121459.A8959@cons.org> <87632.947017515@monkeys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <87632.947017515@monkeys.com>; from rfg@monkeys.com on Tue, Jan 04, 2000 at 12:25:15PM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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