Skip to content
forked from fmtlib/fmt

Commit

Permalink
Merge pull request #130 from fmtlib/master
Browse files Browse the repository at this point in the history
Fix possible infinite recursion in FMT_ASSERT (fmtlib#1744)
  • Loading branch information
sthagen authored Jul 2, 2020
2 parents 6616837 + 5de62af commit db746a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ FMT_BEGIN_NAMESPACE
namespace detail {

FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
print(stderr, "{}:{}: assertion failed: {}", file, line, message);
// Use unchecked std::fprintf to avoid triggering another assertion when
// writing to stderr fails
std::fprintf(stderr, "%s:%d: assertion failed: %s", file, line, message);
// Chosen instead of std::abort to satisfy Clang in CUDA mode during device
// code pass.
std::terminate();
Expand Down

0 comments on commit db746a8

Please sign in to comment.