[clang] [flang] [llvm] [flang] Add -fbacktrace and -fno-backtrace (PR #241967)
Tarun Prabhu via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 19 18:55:55 PST 2026
================
@@ -100,6 +100,31 @@ treated as big-endian for both input and output, while units 26 and 27 will be
treated as little-endian for both input and output.
+## `FLANG_ERROR_BACKTRACE`
+
+Controls the stack trace printed for a fatal runtime error, an `ERROR STOP`
+statement, the `ABORT` extension, or a deadly signal such as `SIGSEGV` or
+`SIGFPE`. A normal `STOP` statement does not print a trace.
+`CALL BACKTRACE()` always prints one, whether or not this variable disables
+the others.
+
+The value must be `0` or `1`. `1` enables the trace and `0` disables it.
+Any other value is ignored. When the variable is unset, the trace is enabled.
+
+`-fbacktrace` is the compiler default and does not set the variable.
+`-fno-backtrace` sets `FLANG_ERROR_BACKTRACE=0` only when the variable is not
+already set, so a value in the environment wins over the option. The option
+takes effect only for the file that contains the main program, because the
----------------
tarunprabhu wrote:
What do yo mean by "the option takes effect only for the file that contains the main program"? Does this mean that a fatal runtime error occurring from a call in a file that does not contain `PROGRAM` will not print a backtrace even if `FLANG_ERROR_BACKTRACE=1`?
https://github.com/llvm/llvm-project/pull/241967
More information about the cfe-commits
mailing list