Next: Directory Options, Previous: Error and Warning Options, Up: Invoking GNU Fortran [Contents][Index]
2.5 Options for debugging your program or GNU Fortran
GNU Fortran has various special options that are used for debugging either your program or the GNU Fortran compiler.
-fdump-fortran-original
-
Output the internal parse tree after translating the source program into internal representation. This option is mostly useful for debugging the GNU Fortran compiler itself. The output generated by this option might change between releases. This option may also generate internal compiler errors for features which have only recently been added.
-fdump-fortran-optimized
-
Output the parse tree after front-end optimization. Mostly useful for debugging the GNU Fortran compiler itself. The output generated by this option might change between releases. This option may also generate internal compiler errors for features which have only recently been added.
-fdump-parse-tree
-
Output the internal parse tree after translating the source program into internal representation. Mostly useful for debugging the GNU Fortran compiler itself. The output generated by this option might change between releases. This option may also generate internal compiler errors for features which have only recently been added. This option is deprecated; use
-fdump-fortran-original
instead. -fdebug-aux-vars
-
Renames internal variables created by the gfortran front end and makes them accessible to a debugger. The name of the internal variables then start with upper-case letters followed by an underscore. This option is useful for debugging the compiler’s code generation together with
-fdump-tree-original
and enabling debugging of the executable program by using-g
or-ggdb3
. -fdump-fortran-global
-
Output a list of the global identifiers after translating into middle-end representation. Mostly useful for debugging the GNU Fortran compiler itself. The output generated by this option might change between releases. This option may also generate internal compiler errors for features which have only recently been added.
-ffpe-trap=list
-
Specify a list of floating point exception traps to enable. On most systems, if a floating point exception occurs and the trap for that exception is enabled, a SIGFPE signal will be sent and the program being aborted, producing a core file useful for debugging. list is a (possibly empty) comma-separated list of the following exceptions: ‘invalid’ (invalid floating point operation, such as
SQRT(-1.0)
), ‘zero’ (division by zero), ‘overflow’ (overflow in a floating point operation), ‘underflow’ (underflow in a floating point operation), ‘inexact’ (loss of precision during operation), and ‘denormal’ (operation performed on a denormal value). The first five exceptions correspond to the five IEEE 754 exceptions, whereas the last one (‘denormal’) is not part of the IEEE 754 standard but is available on some common architectures such as x86.The first three exceptions (‘invalid’, ‘zero’, and ‘overflow’) often indicate serious errors, and unless the program has provisions for dealing with these exceptions, enabling traps for these three exceptions is probably a good idea.
If the option is used more than once in the command line, the lists will be joined: ’
ffpe-trap=
list1ffpe-trap=
list2’ is equivalent toffpe-trap=
list1,list2.Note that once enabled an exception cannot be disabled (no negative form).
Many, if not most, floating point operations incur loss of precision due to rounding, and hence the
ffpe-trap=inexact
is likely to be uninteresting in practice.By default no exception traps are enabled.
-ffpe-summary=list
-
Specify a list of floating-point exceptions, whose flag status is printed to
ERROR_UNIT
when invokingSTOP
andERROR STOP
. list can be either ‘none’, ‘all’ or a comma-separated list of the following exceptions: ‘invalid’, ‘zero’, ‘overflow’, ‘underflow’, ‘inexact’ and ‘denormal’. (See -ffpe-trap for a description of the exceptions.)If the option is used more than once in the command line, only the last one will be used.
By default, a summary for all exceptions but ‘inexact’ is shown.
-fno-backtrace
-
When a serious runtime error is encountered or a deadly signal is emitted (segmentation fault, illegal instruction, bus error, floating-point exception, and the other POSIX signals that have the action ‘core’), the Fortran runtime library tries to output a backtrace of the error.
-fno-backtrace
disables the backtrace generation. This option only has influence for compilation of the Fortran main program.
See Options for Debugging Your Program or GCC in Using the GNU Compiler Collection (GCC), for more information on debugging options.
Next: Directory Options, Previous: Error and Warning Options, Up: Invoking GNU Fortran [Contents][Index]