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):
Steps to Reproduce:
1. gcc fetestexcept_bug.c -lm
SIGFPE is trapped, but fetestexcept fails to identify which FE_ error
In this test case I would expect fetestexcept to return FE_INVALID
Created attachment 117459 [details]
C source illustrating bug
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.