[compiler-rt] a8687dd - [compiler-rt][nsan] Improve nsan reports (#98798)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 14 12:12:00 PDT 2024
Author: Dmitriy Chestnykh
Date: 2024-07-14T12:11:57-07:00
New Revision: a8687dd0262349147ce8ae4d0232a067996be69f
URL: https://github.com/llvm/llvm-project/commit/a8687dd0262349147ce8ae4d0232a067996be69f
DIFF: https://github.com/llvm/llvm-project/commit/a8687dd0262349147ce8ae4d0232a067996be69f.diff
LOG: [compiler-rt][nsan] Improve nsan reports (#98798)
Currently NSAN prints reports that are entirely red and the terminal
prompt after the program exits is red too. With this change we make red
only `WARNING` summary and the rest of the report isn't colored.
This behavior is similar to the behavior of other sanitizers.
Added:
Modified:
compiler-rt/lib/nsan/nsan.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/nsan/nsan.cpp b/compiler-rt/lib/nsan/nsan.cpp
index 7a5f013579dfb..e5a9b7a036e0e 100644
--- a/compiler-rt/lib/nsan/nsan.cpp
+++ b/compiler-rt/lib/nsan/nsan.cpp
@@ -513,6 +513,8 @@ int32_t checkFT(const FT value, ShadowFT Shadow, CheckTypeT CheckType,
}
using ValuePrinter = FTPrinter<FT>;
using ShadowPrinter = FTPrinter<ShadowFT>;
+ Printf("%s", D.Default());
+
Printf("\n"
"%-12s precision (native): dec: %s hex: %s\n"
"%-12s precision (shadow): dec: %s hex: %s\n"
@@ -638,8 +640,9 @@ void fCmpFailFT(const FT Lhs, const FT Rhs, ShadowFT LhsShadow,
const char *const PredicateName = GetPredicateName(Predicate);
Printf("%s", D.Warning());
Printf("WARNING: NumericalStabilitySanitizer: floating-point comparison "
- "results depend on precision\n"
- "%-12s precision dec (native): %s %s %s (%s)\n"
+ "results depend on precision\n");
+ Printf("%s", D.Default());
+ Printf("%-12s precision dec (native): %s %s %s (%s)\n"
"%-12s precision dec (shadow): %s %s %s (%s)\n"
"%-12s precision hex (native): %s %s %s (%s)\n"
"%-12s precision hex (shadow): %s %s %s (%s)\n"
@@ -658,7 +661,6 @@ void fCmpFailFT(const FT Lhs, const FT Rhs, ShadowFT LhsShadow,
FTInfo<ShadowFT>::kCppTypeName, ShadowPrinter::hex(LhsShadow).Buffer,
PredicateName, ShadowPrinter::hex(RhsShadow).Buffer,
GetTruthValueName(ShadowResult), D.End());
- Printf("%s", D.Default());
stack.Print();
if (flags().halt_on_error) {
Printf("Exiting\n");
More information about the llvm-commits
mailing list