diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-04-23 01:08:31 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-04-23 01:08:31 +0000 |
commit | 858f6c4caa45ba1ddf66fcbaa1296d036a5088c9 (patch) | |
tree | 548ca2a0e7d84dc0df612c553eabd2166bae88ab /lib/ubsan | |
parent | af0ecc5abe30a23c1e2f9946a7ade9a87d5ed647 (diff) | |
download | compiler-rt-858f6c4caa45ba1ddf66fcbaa1296d036a5088c9.tar.gz |
[UBSan] Make sure proper error summary is printed for -fsanitize=float-cast-overflow.
float-cast-overflow handler doesn't have source location provided by the
compiler, but we still have *some* source location if we have a
symbolizer.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235567 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan')
-rw-r--r-- | lib/ubsan/ubsan_diag.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/ubsan/ubsan_diag.cc b/lib/ubsan/ubsan_diag.cc index 6f76c6af3..cdcc0e4a7 100644 --- a/lib/ubsan/ubsan_diag.cc +++ b/lib/ubsan/ubsan_diag.cc @@ -46,8 +46,7 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) { static void MaybeReportErrorSummary(Location Loc) { if (!common_flags()->print_summary) return; - // Don't try to unwind the stack trace in UBSan summaries: just use the - // provided location. + const char *ErrorType = "undefined-behavior"; if (Loc.isSourceLocation()) { SourceLocation SLoc = Loc.getSourceLocation(); if (!SLoc.isInvalid()) { @@ -56,12 +55,16 @@ static void MaybeReportErrorSummary(Location Loc) { AI.line = SLoc.getLine(); AI.column = SLoc.getColumn(); AI.function = internal_strdup(""); // Avoid printing ?? as function name. - ReportErrorSummary("undefined-behavior", AI); + ReportErrorSummary(ErrorType, AI); AI.Clear(); return; } + } else if (Loc.isSymbolizedStack()) { + const AddressInfo &AI = Loc.getSymbolizedStack()->info; + ReportErrorSummary(ErrorType, AI); + return; } - ReportErrorSummary("undefined-behavior"); + ReportErrorSummary(ErrorType); } namespace { |