]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/gnu-fortran-command-options/options-for-debugging-your-program-or-gnu-fortran.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / gnu-fortran-command-options / options-for-debugging-your-program-or-gnu-fortran.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: options, debugging, debugging information options
7
8 .. _debugging-options:
9
10 Options for debugging your program or GNU Fortran
11 *************************************************
12
13 GNU Fortran has various special options that are used for debugging
14 either your program or the GNU Fortran compiler.
15
16 .. index:: fdump-fortran-original
17
18 .. option:: -fdump-fortran-original
19
20 Output the internal parse tree after translating the source program
21 into internal representation. This option is mostly useful for
22 debugging the GNU Fortran compiler itself. The output generated by
23 this option might change between releases. This option may also
24 generate internal compiler errors for features which have only
25 recently been added.
26
27 .. index:: fdump-fortran-optimized
28
29 .. option:: -fdump-fortran-optimized
30
31 Output the parse tree after front-end optimization. Mostly useful for
32 debugging the GNU Fortran compiler itself. The output generated by
33 this option might change between releases. This option may also
34 generate internal compiler errors for features which have only
35 recently been added.
36
37 .. index:: fdump-parse-tree
38
39 .. option:: -fdump-parse-tree
40
41 Output the internal parse tree after translating the source program
42 into internal representation. Mostly useful for debugging the GNU
43 Fortran compiler itself. The output generated by this option might
44 change between releases. This option may also generate internal
45 compiler errors for features which have only recently been added. This
46 option is deprecated; use ``-fdump-fortran-original`` instead.
47
48 .. index:: fdebug-aux-vars
49
50 .. option:: -fdebug-aux-vars
51
52 Renames internal variables created by the gfortran front end and makes
53 them accessible to a debugger. The name of the internal variables then
54 start with upper-case letters followed by an underscore. This option is
55 useful for debugging the compiler's code generation together with
56 ``-fdump-tree-original`` and enabling debugging of the executable
57 program by using ``-g`` or ``-ggdb3``.
58
59 .. index:: fdump-fortran-global
60
61 .. option:: -fdump-fortran-global
62
63 Output a list of the global identifiers after translating into
64 middle-end representation. Mostly useful for debugging the GNU Fortran
65 compiler itself. The output generated by this option might change
66 between releases. This option may also generate internal compiler
67 errors for features which have only recently been added.
68
69 .. index:: ffpe-trap=list
70
71 .. option:: -ffpe-trap={list}
72
73 Specify a list of floating point exception traps to enable. On most
74 systems, if a floating point exception occurs and the trap for that
75 exception is enabled, a SIGFPE signal will be sent and the program
76 being aborted, producing a core file useful for debugging. :samp:`{list}`
77 is a (possibly empty) comma-separated list of the following
78 exceptions: :samp:`invalid` (invalid floating point operation, such as
79 ``SQRT(-1.0)``), :samp:`zero` (division by zero), :samp:`overflow`
80 (overflow in a floating point operation), :samp:`underflow` (underflow
81 in a floating point operation), :samp:`inexact` (loss of precision
82 during operation), and :samp:`denormal` (operation performed on a
83 denormal value). The first five exceptions correspond to the five
84 IEEE 754 exceptions, whereas the last one (:samp:`denormal`) is not
85 part of the IEEE 754 standard but is available on some common
86 architectures such as x86.
87
88 The first three exceptions (:samp:`invalid`, :samp:`zero`, and
89 :samp:`overflow`) often indicate serious errors, and unless the program
90 has provisions for dealing with these exceptions, enabling traps for
91 these three exceptions is probably a good idea.
92
93 If the option is used more than once in the command line, the lists will
94 be joined: ' ``ffpe-trap=``:samp:`{list1}` ``ffpe-trap=``:samp:`{list2}` '
95 is equivalent to ``ffpe-trap=``:samp:`{list1}`, :samp:`{list2}`.
96
97 Note that once enabled an exception cannot be disabled (no negative form).
98
99 Many, if not most, floating point operations incur loss of precision
100 due to rounding, and hence the ``ffpe-trap=inexact`` is likely to
101 be uninteresting in practice.
102
103 By default no exception traps are enabled.
104
105 .. index:: ffpe-summary=list
106
107 .. option:: -ffpe-summary={list}
108
109 Specify a list of floating-point exceptions, whose flag status is printed
110 to ``ERROR_UNIT`` when invoking ``STOP`` and ``ERROR STOP``.
111 :samp:`{list}` can be either :samp:`none`, :samp:`all` or a comma-separated list
112 of the following exceptions: :samp:`invalid`, :samp:`zero`, :samp:`overflow`,
113 :samp:`underflow`, :samp:`inexact` and :samp:`denormal`. (See
114 :option:`-ffpe-trap` for a description of the exceptions.)
115
116 If the option is used more than once in the command line, only the
117 last one will be used.
118
119 By default, a summary for all exceptions but :samp:`inexact` is shown.
120
121 .. index:: fno-backtrace, backtrace, trace
122
123 .. option:: -fno-backtrace
124
125 When a serious runtime error is encountered or a deadly signal is
126 emitted (segmentation fault, illegal instruction, bus error,
127 floating-point exception, and the other POSIX signals that have the
128 action :samp:`core`), the Fortran runtime library tries to output a
129 backtrace of the error. ``-fno-backtrace`` disables the backtrace
130 generation. This option only has influence for compilation of the
131 Fortran main program.
132
133 See :ref:`gcc:debugging-options`, for more information on
134 debugging options.