Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 157584 - Second SIGFPE is missed
Summary: Second SIGFPE is missed
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 3
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2005-05-12 20:51 UTC by djm
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-05-18 04:42:24 UTC

Attachments (Terms of Use)
C source code (deleted)
2005-05-12 20:51 UTC, djm
no flags Details

Description djm 2005-05-12 20:51:32 UTC
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:

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++);

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) {

Comment 1 djm 2005-05-12 20:51:32 UTC
Created attachment 114313 [details]
C source code

Comment 2 Roland McGrath 2005-05-18 04:42:24 UTC
The program should use sigsetjmp and siglongjmp.
Using plain longjmp to leave a signal handler leaves signals blocked.

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