@item Debugging Options
@xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
@gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original @gol
--fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list} @gol
+-fdebug-aux-vars -fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list} @gol
-ffpe-summary=@var{list}
}
compiler errors for features which have only recently been added. This
option is deprecated; use @code{-fdump-fortran-original} instead.
+@item -fdebug-aux-vars
+@opindex @code{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
+@code{-fdump-tree-original} and enabling debugging of the executable
+program by using @code{-g} or @code{-ggdb3}.
+
@item -fdump-fortran-global
@opindex @code{fdump-fortran-global}
Output a list of the global identifiers after translating into
Fortran RejectNegative
Treat lines with 'D' in column one as comments.
+fdebug-aux-vars
+Fortran Var(flag_debug_aux_vars)
+Issue debug information for compiler-generated auxiliary variables.
+
fdec
Fortran Var(flag_dec)
Enable all DEC language extensions.
return t;
}
+static int num_var;
+
+#define MAX_PREFIX_LEN 20
+
+static tree
+create_var_debug_raw (tree type, const char *prefix)
+{
+ /* Space for prefix + "_" + 10-digit-number + \0. */
+ char name_buf[MAX_PREFIX_LEN + 1 + 10 + 1];
+ tree t;
+ int i;
+
+ if (prefix == NULL)
+ prefix = "gfc";
+ else
+ gcc_assert (strlen (prefix) <= MAX_PREFIX_LEN);
+
+ for (i = 0; prefix[i] != 0; i++)
+ name_buf[i] = gfc_wide_toupper (prefix[i]);
+
+ snprintf (name_buf + i, sizeof (name_buf) - i, "_%d", num_var++);
+
+ t = build_decl (input_location, VAR_DECL, get_identifier (name_buf), type);
+
+ /* We want debug info for it. */
+ DECL_IGNORED_P (t) = 0;
+ /* It should not be nameless. */
+ DECL_NAMELESS (t) = 0;
+
+ /* Make the variable writable. */
+ TREE_READONLY (t) = 0;
+
+ DECL_EXTERNAL (t) = 0;
+ TREE_STATIC (t) = 0;
+ TREE_USED (t) = 1;
+
+ return t;
+}
+
/* Creates a variable declaration with a given TYPE. */
tree
{
tree t;
+ if (flag_debug_aux_vars)
+ return create_var_debug_raw (type, prefix);
+
t = create_tmp_var_raw (type, prefix);
/* No warnings for anonymous variables. */