Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2002 11:00:06 -0700 (PDT)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/38170: fpgetmask, fpsetmask yield strange results
Message-ID:  <200206011800.g51I06e09224@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/38170; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: Andreas Haakh <ah@alvman.Haakh.de>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/38170: fpgetmask, fpsetmask yield strange results
Date: Sun, 2 Jun 2002 03:54:07 +1000 (EST)

 On Fri, 17 May 2002, Andreas Haakh wrote:
 
 > >Description:
 > 	I tried to modify the default fp_exception-mask. The results from fpgetmask and fpsetmask (and probably some other fp[sg]et-routines) are buggy.
 
 fpsetmask() is fixed in -current.  The complement of the mask (ANDed with
 the mask bitfield) was being returned.  The other routines seem to be OK.
 
 > >How-To-Repeat:
 > 	The following codeexample shows this strange behaviour:
 >
 > #include <stdio.h>
 > #include <ieeefp.h>
 >
 > int main (void) {
 >
 >     fp_except_t except, res;
 >
 >     res=fpgetmask();
 >
 >     printf ("fp_except from fpgetmask: \t0x%02x!\n", res);
 >
 >     except = FP_X_INV|FP_X_DZ|FP_X_OFL|FP_X_STK;
 
 Note that FP_X_STK is output-only.  Attempts to set it are ignored by
 fpsetmask(), and fpgetmask() returns whatever the hardware gives for
 attempts to set it in other initializations that don't mask it.  It
 is documented as "reserved" in at least the i486 manual, so strictly
 it should not be set unconditionally, but the kernel just tries to
 write 0 to it.  I wish that this bit controlled stack exceptions
 independently of invalid operand exceptions, so that SIGFPEs could
 be generated for the programming error of stack overflow without
 generating them for invalid operands which might not even be an error
 in programs that generate NaNs intentionally.
 
 Bruce
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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