Bug 165129

Summary: fetestexcept(FE_ALL_EXCEPT) always returns 0
Product: [Fedora] Fedora Reporter: John Ellson <john.ellson>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-08-06 08:22:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
C source illustrating bug none

Description John Ellson 2005-08-04 15:59:23 UTC
Description of problem:
fetestexcept(FE_ALL_EXCEPT) always returns 0

The fenv(3) man page states:
      The fetestexcept function returns a word in which the bits are set that
      were set in the argument excepts and for which the corresponding excep-
      tion is currently set.

And then later:
       glibc  2.2  supports  the  functions  feenableexcept  and
       fedisableexcept to set individual floating point traps, and fegetexcept
       to query the state.

So I think, by exclusion, that glibc is only providing a stub for fetestexcept()
which probably makes this bug report an RFE ?

Version-Release number of selected component (if applicable):
glibc-2.3.90-7
kernel-2.6.12-1.1448_FC5

How reproducible:
100%

Steps to Reproduce:
1. gcc fetestexcept_bug.c -lm
2. ./a.out
3.
  
Actual results:
SIGFPE is trapped, but fetestexcept fails to identify which FE_ error

Expected results:
In this test case I would expect fetestexcept to return FE_INVALID

Additional info:

Comment 1 John Ellson 2005-08-04 15:59:23 UTC
Created attachment 117459 [details]
C source illustrating bug

Comment 2 Jakub Jelinek 2005-08-06 08:22:32 UTC
That's misunderstanding.  Either you don't get signals and fetestexcept etc.
are usable, or you get signals and there are no accrued exceptions (as they are
signalled immediately).  You can use sigaction with SA_SIGINFO and look at
info->si_code to determine which exception happened.
In your case it will be FPE_FLTINV.