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

ID 767251
Date 7/13/2023
Public

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

Document Table of Contents

Debug a Program that Encounters a Signal or Exception

If your program encounters a signal (exception) at runtime, you may want to recompile and relink with certain command-line options before debugging the cause. The following will make it easier to debug the program:

  • Use the fpe[:]n option to control the handling of floating point exceptions.

  • To generate sufficient symbol table information and debug unoptimized code, as with other debugging tasks, use the -g (Linux* and macOS) or /debug:full (Windows*) compiler option.

Debug an Exception in the Microsoft Debugger

You can request that the program always stop when a certain type of exception occurs. Because certain exceptions are caught by default by the Intel® Fortran runtime library, your program stops in the runtime library code. In most cases, you want the program to stop in your program's source code instead.

To change how an exception is handled in the Microsoft debugger:

  1. In the Debug menu, select Exceptions.

  2. View the displayed exceptions.

  3. Select Windows Exceptions. Select each type of exception to be changed and change its handling using the radio buttons.

  4. Start program execution using Start in the Debug menu.

  5. When the exception occurs, you can now view the source line being executed, examine current variable values, execute the next instruction, and so on, to help you better understand that part of your program.

  6. After you locate the error and correct the program, consider whether you want to reset the appropriate type of exception to "Use Parent Setting" before you debug the program again.

For machine exceptions, you can use the just-in-time debugging feature to debug your programs as they run outside of the visual development environment. To do this, set the following items:

  • In Tools > Options, select Native in the Debugging Just-In Time category.

  • Set the FOR_IGNORE_EXCEPTIONS, as listed in Supported Environment Variables, to TRUE.