================
@@ -326,6 +326,21 @@ void ExecutionEnvironment::Configure(int ac, const char
*av[],
}
}
+ // FLANG_ERROR_BACKTRACE overrides the -fbacktrace default. The value must
+ // be 0 or 1. Any other value is ignored. -fno-backtrace supplies "0" when
+ // the variable is not already set.
+ backtrace = true;
+ if (auto *x{std::getenv("FLANG_ERROR_BACKTRACE")}) {
+ char *end;
+ auto n{std::strtol(x, &end, 10)};
+ if (n >= 0 && n <= 1 && *end == '\0') {
+ backtrace = (n != 0);
+ } else {
+ std::fprintf(stderr,
+ "Fortran runtime: FLANG_ERROR_BACKTRACE=%s is invalid; ignored\n",
x);
----------------
tarunprabhu wrote:
Perhaps it would be better to say that the value of FLANG_ERROR_BACKTRACE must
be exactly 0 or 1. It may save the user the trouble of having to dig through
the documentation.
https://github.com/llvm/llvm-project/pull/241967
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits