diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -434,17 +434,19 @@ dump(Die, 2) << '\n'; } - // Verify that children don't intersect. - const auto IntersectingChild = ParentRI.insert(RI); - if (IntersectingChild != ParentRI.Children.end()) { - ++NumErrors; - error() << "DIEs have overlapping address ranges:"; - dump(Die); - dump(IntersectingChild->Die) << '\n'; + if (!RI.Ranges.empty()) { + // Verify that children don't intersect. + const auto IntersectingChild = ParentRI.insert(RI); + if (IntersectingChild != ParentRI.Children.end()) { + ++NumErrors; + error() << "DIEs have overlapping address ranges:"; + dump(Die); + dump(IntersectingChild->Die) << '\n'; + } } // Verify that ranges are contained within their parent. - bool ShouldBeContained = !Ranges.empty() && !ParentRI.Ranges.empty() && + bool ShouldBeContained = !RI.Ranges.empty() && !ParentRI.Ranges.empty() && !(Die.getTag() == DW_TAG_subprogram && ParentRI.Die.getTag() == DW_TAG_subprogram); if (ShouldBeContained && !ParentRI.contains(RI)) {