[llvm] r367959 - Silence ubsan after r367926.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 17:21:30 PDT 2019
Author: pcc
Date: Mon Aug 5 17:21:30 2019
New Revision: 367959
URL: http://llvm.org/viewvc/llvm-project?rev=367959&view=rev
Log:
Silence ubsan after r367926.
Fixes e.g.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/14273
We can't left shift here because left shifting of a negative number is UB.
The same doesn't apply to unsigned arithmetic, but switching to unsigned
doesn't appear to stop ubsan from complaining, so we need to mask out the
high bits.
Modified:
llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
Modified: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp?rev=367959&r1=367958&r2=367959&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp Mon Aug 5 17:21:30 2019
@@ -178,6 +178,7 @@ std::error_code SymbolizableObjectFile::
if (UntagAddresses) {
// For kernel addresses, bits 56-63 need to be set, so we sign extend bit 55
// into bits 56-63 instead of masking them out.
+ SymbolAddress &= (1ull << 56) - 1;
SymbolAddress = (int64_t(SymbolAddress) << 8) >> 8;
}
if (OpdExtractor) {
More information about the llvm-commits
mailing list