From 1b973fca01207665e87252c5eac720154921be8f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 20 Jul 2016 17:41:18 +0000 Subject: Use iterators to avoid dereferencing end(). Thanks to George Rimar for finding the problem. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@276144 91177308-0d34-0410-b5e6-96231b3b80d8 --- ELF/Relocations.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp index 1ed8653a0..e5e409dd6 100644 --- a/ELF/Relocations.cpp +++ b/ELF/Relocations.cpp @@ -525,11 +525,11 @@ static void scanRelocs(InputSectionBase &C, ArrayRef Rels) { ArrayRef SectionData = C.getSectionData(); const uint8_t *Buf = SectionData.begin(); - SectionPiece *PieceI = nullptr; - SectionPiece *PieceE = nullptr; + std::vector::iterator PieceI; + std::vector::iterator PieceE; if (auto *Eh = dyn_cast>(&C)) { - PieceI = &*Eh->Pieces.begin(); - PieceE = &*Eh->Pieces.end(); + PieceI = Eh->Pieces.begin(); + PieceE = Eh->Pieces.end(); } for (auto I = Rels.begin(), E = Rels.end(); I != E; ++I) { -- cgit v1.2.3