Description of problem: I'm trying to catch SIGFPE when generated by an integer divide by 0 exception. The first is caught and handled by my handler sucessfully. The second is handled by the kernel and never passed to my handler. Version-Release number of selected component (if applicable): I've tried this on FC2, FC3, and FC4T3 (all X86_64). It works fine on RH73. How reproducible: Always. Steps to Reproduce: 1. g++ -o t t.c 2. ./t Actual results: SIGFPE caught 1 of 2 Floating exception Expected results: (from RH73) SIGFPE caught 1 of 2 SIGFPE caught 2 of 2 Additional info: source code ---------------------- CUT HERE ---------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <float.h> #include <setjmp.h> typedef void (*fptr)(int); jmp_buf env; void Catcher(int arg1) { static int count=1; printf("SIGFPE caught %d of 2\n", count++); longjmp(env,1); } void run_test(int a, int b) { signal(SIGFPE, (fptr)Catcher); if (setjmp(env)==0) { int c = a/b; } } int main (int argc, char** argv) { run_test(1,0); run_test(2,0); }
Created attachment 114313 [details] C source code
The program should use sigsetjmp and siglongjmp. Using plain longjmp to leave a signal handler leaves signals blocked.