Bug 165129 - fetestexcept(FE_ALL_EXCEPT) always returns 0
fetestexcept(FE_ALL_EXCEPT) always returns 0
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2005-08-04 11:59 EDT by John Ellson
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-08-06 04:22:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
C source illustrating bug (590 bytes, text/plain)
2005-08-04 11:59 EDT, John Ellson
no flags Details

  None (edit)
Description John Ellson 2005-08-04 11:59:23 EDT
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):

How reproducible:

Steps to Reproduce:
1. gcc fetestexcept_bug.c -lm
2. ./a.out
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 11:59:23 EDT
Created attachment 117459 [details]
C source illustrating bug
Comment 2 Jakub Jelinek 2005-08-06 04:22:32 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.