Fortran divide check crashes interactive '386
Heiko Blume
src at scuzzy.in-berlin.de
Wed Jan 2 08:01:03 AEST 1991
rhl at 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 at 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
More information about the Comp.unix.programmer
mailing list