Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Override the Default Runtime Library Exception Handler

To override the default runtime library exception handler on Linux* and macOS, your application must call signal to change the action for the signal of interest.

For example, assume that you want to change the signal action to cause your application to call abort() and generate a core file.

The following example adds a function named clear_signal_ to call signal() and change the action for the SIGABRT signal:

#include <signal.h>
  void clear_signal_() { signal (SIGABRT, SIG_DFL); }

  int myabort_() {
    abort();
    return 0;
}

A call to the clear_signal() local routine must be added to main. Make sure that the call appears before any call to the local myabort() routine:

program aborts
integer i

call clear_signal()

i = 3
if (i < 5) then
call myabort()
end if
end