summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-15 12:39:47 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-15 12:39:47 +0000
commit99798ba40e3813d50822f00275793e2880383fc7 (patch)
tree62c7c06768cd766d8d1a1c1c50f8a53ec3cebf53 /gcc
parenta1758a1397ab575a19ef3d19cbf15122b0950515 (diff)
downloadgcc-99798ba40e3813d50822f00275793e2880383fc7.tar.gz
* gfortran.h (gfc_option_t): Add flag_backtrace field.
* lang.opt: Add -fbacktrace option. * invoke.texi: Document the new option. * trans-decl.c (gfc_build_builtin_function_decls): Add new option to the call to set_std. * options.c (gfc_init_options, gfc_handle_option): Handle the new option. * runtime/backtrace.c: New file. * runtime/environ.c (variable_table): New GFORTRAN_ERROR_BACKTRACE environment variable. * runtime/compile_options.c (set_std): Add new argument. * runtime/main.c (store_exe_path, full_exe_path): New functions. * runtime/error.c (sys_exit): Add call to show_backtrace. * libgfortran.h (options_t): New backtrace field. (store_exe_path, full_exe_path, show_backtrace): New prototypes. * configure.ac: Add checks for execinfo.h, execvp, pipe, dup2, close, fdopen, strcasestr, getrlimit, backtrace, backtrace_symbols and getppid. * Makefile.am: Add runtime/backtrace.c. * fmain.c (main): Add call to store_exe_path. * Makefile.in: Renegerate. * config.h.in: Renegerate. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122954 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog10
-rw-r--r--gcc/fortran/gfortran.h1
-rw-r--r--gcc/fortran/invoke.texi13
-rw-r--r--gcc/fortran/lang.opt4
-rw-r--r--gcc/fortran/options.c5
-rw-r--r--gcc/fortran/trans-decl.c7
6 files changed, 36 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 449f9b89d04..a738975aa31 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2007-03-15 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ * gfortran.h (gfc_option_t): Add flag_backtrace field.
+ * lang.opt: Add -fbacktrace option.
+ * invoke.texi: Document the new option.
+ * trans-decl.c (gfc_build_builtin_function_decls): Add new
+ option to the call to set_std.
+ * options.c (gfc_init_options, gfc_handle_option): Handle the
+ new option.
+
2007-03-15 Tobias Burnus <burnus@gcc.gnu.org>
Paul Thomas <pault@gcc.gnu.org>
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 52553a43005..b806f18cea9 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1659,6 +1659,7 @@ typedef struct
int flag_f2c;
int flag_automatic;
int flag_backslash;
+ int flag_backtrace;
int flag_allow_leading_underscore;
int flag_dump_core;
int flag_external_blas;
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index c4d09024586..ef9825cbd7e 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -134,8 +134,8 @@ and Warnings}.
@item Debugging Options
@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
-@gccoptlist{-fdump-parse-tree -ffpe-trap=@var{list}
--fdump-core}
+@gccoptlist{-fdump-parse-tree -ffpe-trap=@var{list} @gol
+-fdump-core -fbacktrace}
@item Directory Options
@xref{Directory Options,,Options for Directory Search}.
@@ -562,6 +562,15 @@ zero), @samp{overflow} (overflow in a floating point operation),
@samp{precision} (loss of precision during operation) and @samp{denormal}
(operation produced a denormal value).
+@cindex -fbacktrace option
+@cindex options, -fbacktrace
+@item -fbacktrace
+@cindex backtrace
+@cindex trace
+Specify that, when a runtime error is encountered, the Fortran runtime
+library should output a backtrace of the error. This option
+only has influence for compilation of the Fortran main program.
+
@cindex -fdump-core option
@cindex options, -fdump-core
@item -fdump-core
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index b1d5f2288a7..c1697fccb10 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -93,6 +93,10 @@ fbackslash
Fortran
Specify that backslash in string introduces an escape character
+fbacktrace
+Fortran
+Produce a backtrace when a runtime error is encountered
+
fblas-matmul-limit=
Fortran RejectNegative Joined UInteger
-fblas-matmul-limit=<n> Size of the smallest matrix for which matmul will use BLAS
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index e4f6092663c..96bedabffb1 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -94,6 +94,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.flag_preprocessed = 0;
gfc_option.flag_automatic = 1;
gfc_option.flag_backslash = 1;
+ gfc_option.flag_backtrace = 0;
gfc_option.flag_allow_leading_underscore = 0;
gfc_option.flag_dump_core = 0;
gfc_option.flag_external_blas = 0;
@@ -474,6 +475,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
gfc_option.flag_backslash = value;
break;
+ case OPT_fbacktrace:
+ gfc_option.flag_backtrace = value;
+ break;
+
case OPT_fdump_core:
gfc_option.flag_dump_core = value;
break;
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 862958a1a95..a98b11ce5dd 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2378,7 +2378,8 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_set_std =
gfc_build_library_function_decl (get_identifier (PREFIX("set_std")),
void_type_node,
- 4,
+ 5,
+ gfc_int4_type_node,
gfc_int4_type_node,
gfc_int4_type_node,
gfc_int4_type_node,
@@ -3144,7 +3145,9 @@ gfc_generate_function_code (gfc_namespace * ns)
build_int_cst (gfc_int4_type_node,
pedantic),
build_int_cst (gfc_int4_type_node,
- gfc_option.flag_dump_core));
+ gfc_option.flag_dump_core),
+ build_int_cst (gfc_int4_type_node,
+ gfc_option.flag_backtrace));
gfc_add_expr_to_block (&body, tmp);
}