> I'm seeing discrepancies between the way that floating point
> exceptions are handled on different architectures. Briefly, I have a
> program that uses the glibc function feenableexcept() to enable SIGFPE
> on divide-by-zero errors, then installs a SIGFPE handler that uses
> sigsetjmp/siglongjmp, then divides 1.0 by 0.0 twice.
>
> What I expect to happen is for my signal handler to be called twice.
> What actually happens varies:
...
> my signal handler is called the first time, and then the second
> attempt gets "inf". I've run this under gdb as well; the second SIGFPE is
> not received by the process
The x86 like behaviour happens on ppc64 too:
exceptions enabled: 0
exceptions enabled: 4000000
hello
in handler
abort
a/b=inf
terminating
There is a reason for this. A signal handler might want to do floating
point so exceptions are disabled upon entering a signal handler.
Now the question that needs to be answered is whether sigsetjmp should
save the floating point exception register. I asked our resident
standards expert Chris Yeoh and the answer is no.
So the x86, ppc32 and ppc64 behaviour looks correct.
Anton
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/