diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-07-20 18:54:31 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-07-20 18:54:31 +0000 |
commit | 56ca8057dae4bc5d7a0e6f60872c1f3a4beda81a (patch) | |
tree | 7777dd6c8b686bcc9eea511a5af3b74b81bb265a | |
parent | b385deb5306ab0cfd92840568f6c6410a8f6427f (diff) |
Avoid use of uninitialized iterators.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@276157 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | ELF/Relocations.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp index 66493302b..106cc7c9c 100644 --- a/ELF/Relocations.cpp +++ b/ELF/Relocations.cpp @@ -525,11 +525,11 @@ static void scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) { ArrayRef<uint8_t> SectionData = C.getSectionData(); const uint8_t *Buf = SectionData.begin(); - std::vector<SectionPiece>::iterator PieceI; - std::vector<SectionPiece>::iterator PieceE; + SectionPiece *PieceI = nullptr; + SectionPiece *PieceE = nullptr; if (auto *Eh = dyn_cast<EhInputSection<ELFT>>(&C)) { - PieceI = Eh->Pieces.begin(); - PieceE = Eh->Pieces.end(); + PieceI = &*Eh->Pieces.begin(); + PieceE = PieceI + Eh->Pieces.size(); } for (auto I = Rels.begin(), E = Rels.end(); I != E; ++I) { |