diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index 960d928b510a..f41698e17a02 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -201,12 +201,12 @@ void ICF::segregate(InputSection **Begin, InputSection **End, template void ICF::forEachGroup(std::vector *> &V, Comparator Eq) { - for (auto I = V.begin(), E = V.end(); I != E;) { + for (InputSection **I = V.data(), **E = I + V.size(); I != E;) { InputSection *Head = *I; auto Bound = std::find_if(I + 1, E, [&](InputSection *S) { return S->GroupId != Head->GroupId; }); - segregate(&*I, &*Bound, Eq); + segregate(I, Bound, Eq); I = Bound; } }