[lld] r276157 - Avoid use of uninitialized iterators.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 11:54:31 PDT 2016
Author: rafael
Date: Wed Jul 20 13:54:31 2016
New Revision: 276157
URL: http://llvm.org/viewvc/llvm-project?rev=276157&view=rev
Log:
Avoid use of uninitialized iterators.
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=276157&r1=276156&r2=276157&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Jul 20 13:54:31 2016
@@ -525,11 +525,11 @@ static void scanRelocs(InputSectionBase<
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) {
More information about the llvm-commits
mailing list