From: Jonas Devlieghere Date: Tue, 8 Jan 2019 01:08:09 +0000 (+0000) Subject: [dsymutil] Fix assertion triggered by empty address range. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ece8d35864e0aa62e7c91919b8e2e931bc29105;p=llvm [dsymutil] Fix assertion triggered by empty address range. An assertion was hit when running dsymutil on a gcc generated binary that contained an empty address range. Address ranges are stored in an interval map of half open intervals. Since the interval is empty and therefore meaningless, we simply don't add it to the map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350591 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/dsymutil/CompileUnit.cpp b/tools/dsymutil/CompileUnit.cpp index 67e1739ae10..4654e41b217 100644 --- a/tools/dsymutil/CompileUnit.cpp +++ b/tools/dsymutil/CompileUnit.cpp @@ -92,7 +92,11 @@ void CompileUnit::addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset) { void CompileUnit::addFunctionRange(uint64_t FuncLowPc, uint64_t FuncHighPc, int64_t PcOffset) { - Ranges.insert(FuncLowPc, FuncHighPc, PcOffset); + // Don't add empty ranges to the interval map. They are a problem because + // the interval map expects half open intervals. This is safe because they + // are empty anyway. + if (FuncHighPc != FuncLowPc) + Ranges.insert(FuncLowPc, FuncHighPc, PcOffset); this->LowPc = std::min(LowPc, FuncLowPc + PcOffset); this->HighPc = std::max(HighPc, FuncHighPc + PcOffset); }