<div dir="ltr">Thank you for your investigation. On it.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 26, 2016 at 6:21 AM, George Rimar <span dir="ltr"><<a href="mailto:grimar@accesssoftek.com" target="_blank">grimar@accesssoftek.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">grimar added a comment.<br>
<br>
Problem is in<br>
<br>
template <class ELFT><br>
void ICF<ELFT>::forEachGroup(std::vector<InputSection<ELFT> *> &V,<br>
Comparator Eq) {<br>
for (auto I = V.begin(), E = V.end(); I != E;) {<br>
<span class=""> InputSection<ELFT> *Head = *I;<br>
</span> auto Bound = std::find_if(I + 1, E, [&](InputSection<ELFT> *S) {<br>
return S->GroupId != Head->GroupId;<br>
});<br>
segregate(&*I, &*Bound, Eq);<br>
I = Bound;<br>
}<br>
}<br>
<br>
Bound == V.end() and that crashes at<br>
<br>
segregate(&*I, &*Bound, Eq);<br>
<br>
Have next values for V:<br>
+ [0] 0x0096f698 {RelocSections={Val={Val={Value=0x00000000 } } } OutSecOff=0x0000000000000000 GroupId=0x8000000055626995 }<br>
+ [1] 0x0096f6c8 {RelocSections={Val={Val={Value=0x00000000 } } } OutSecOff=0x0000000000000000 GroupId=0x8000000055626995 }<br>
+ [2] 0x0096f668 {RelocSections={Val={Val={Value=0x00000000 } } } OutSecOff=0x0000000000000000 GroupId=0x80000000af442220 }<br>
Head->GroupId == 0x8000000055626995<br>
<br>
at first iteration it sets I to V[2]. Then on next one finds nothing, because I + 1 is already == E.<br>
If I add next after "auto Bound ="<br>
<br>
if (Bound == V.end())<br>
return;<br>
<br>
all tests pass for me.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D17529" rel="noreferrer" target="_blank">http://reviews.llvm.org/D17529</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>