Signal Handlers

Signal Handlers


Does anyone have an example of how to install a signal handler in FORTRAN. After reading the signal(3f) man page I came up with something like this, but it doesn't work. I'm trying to catch a floating point overflow (72).

program main

ierr = signal(72,myhandler,-1)
write(6,*) "ierr=",ierr


subroutine myhandler

write(6,*) "Called my handler"


The value returned by ierr is zero, according to the man page it should return the address of the subroutine. What am I doing wrong here? Any help would be greatly appreciated!


Bryan Walsh

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I'm not a UNIX expert, but reading the manual suggests that the code you want is 75 for SIGFPE. See section 8.3 of the User Manual for details.


Retired 12/31/2016


I do want 72 since this is the signal being sent, but I've also tried 75.


Hmm. Well, you've now gone outside what I know. I'll pass your question on to our exception handling expert and see what he says.


Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today