Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 2002 09:01:11 +0200 (CEST)
From:      Andreas Haakh <ah@alvman.Haakh.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/38170: fpgetmask, fpsetmask yield strange results
Message-ID:  <200205170701.g4H71BVv000804@alvman.Haakh.de>

next in thread | raw e-mail | index | archive | help

>Number:         38170
>Category:       kern
>Synopsis:       fpgetmask, fpsetmask yield strange results
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 17 00:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Haakh
>Release:        FreeBSD 4.6-RC i386
>Organization:
Ingenieurbüro für Baustatik
>Environment:
System: FreeBSD alvman.Haakh.de 4.6-RC FreeBSD 4.6-RC #0: Fri May 17 07:18:23 CEST 2002 root@alvman.Haakh.de:/usr/obj/usr/src/sys/ALVMAN i386 i686-class CPU

>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.

>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;

    printf ("attempt to set fp_except to: \t0x%02x!\n", except);

    res=fpsetmask(except);

    printf ("fp_except from fpsetmask: \t0x%02x!\n", res);

    res=fpgetmask();

    printf ("fp_except from fpgetmask: \t0x%02x!\n", res);

    res=fpsetmask(except);

    printf ("retry to set fp_except to:\t0x%02x!\n", except);

    res=fpsetmask(except);

    printf ("fp_except from fpsetmask: \t0x%02x!\n", res);

    res=fpgetmask();

    printf ("fp_except from fpgetmask: \t0x%02x!\n", res);

    exit (except);

}

	The results from this prog are:


fp_except from fpgetmask: 	0x00!
attempt to set fp_except to: 	0x4d!
fp_except from fpsetmask: 	0x3f!
fp_except from fpgetmask: 	0x0d!
retry to set fp_except to:	0x4d!
fp_except from fpsetmask: 	0x32!
fp_except from fpgetmask: 	0x0d!


>Fix:
	correct the inline functions and/or macros in <machine/floatingpoint.h>
	I have not enough knowledge to do it myself...


>Release-Note:
>Audit-Trail:
>Unformatted:

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?200205170701.g4H71BVv000804>