Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!uunet!mcsun!unido!fauern!opal!tmpmbx!scuzzy!src From: src@scuzzy.in-berlin.de (Heiko Blume) Newsgroups: comp.unix.programmer Subject: Re: Fortran divide check crashes interactive '386 Message-ID: <1991Jan01.210103.9483@scuzzy.in-berlin.de> Date: 1 Jan 91 21:01:03 GMT References: <4983@idunno.Princeton.EDU> Organization: Contributed Software Lines: 35 rhl@grendel.Princeton.EDU (Robert Lupton (the Good)) writes: >A colleague has a 386 running Interactive's unix, and the LPI fortran >compiler. He reported that a divide by zero in fortran crashes the >system, so I wrote a trivial C programme to catch SIGFPE --- it works >fine. So I wrote a stub to set the handler from fortran, and now it >works fine ONCE --- if you run the fortran a second time it still >crashes the system. either /* POSIX signal facilities */ your_catcher() { printf("Division by zero\n"); } main() { [...] sigset(SIGFPE,your_catcher); [...] } or /* plain signal facilities */ your_catcher() { signal(SIGFPE,your_catcher); printf("Division by zero\n"); } main() { [...] signal(SIGFPE,your_catcher); [....] } should do it. however, if you want to set/longjmp() with the POSIX thing you must either engage sigrelse() or use sigsetjmp(2) and siglongjmp() in the first place. -- Heiko Blume <-+-> src@scuzzy.in-berlin.de <-+-> (+49 30) 691 88 93 public source archive [HST V.42bis]: scuzzy Any ACU,f 38400 6919520 gin:--gin: nuucp sword: nuucp uucp scuzzy!/src/README /your/home