[PATCH] D17529: ELF: Implement ICF.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 07:11:57 PST 2016


Thank you for your investigation. On it.

On Fri, Feb 26, 2016 at 6:21 AM, George Rimar <grimar at accesssoftek.com>
wrote:

> grimar added a comment.
>
> Problem is in
>
>   template <class ELFT>
>   void ICF<ELFT>::forEachGroup(std::vector<InputSection<ELFT> *> &V,
>                                Comparator Eq) {
>     for (auto I = V.begin(), E = V.end(); I != E;) {
>       InputSection<ELFT> *Head = *I;
>       auto Bound = std::find_if(I + 1, E, [&](InputSection<ELFT> *S) {
>         return S->GroupId != Head->GroupId;
>       });
>       segregate(&*I, &*Bound, Eq);
>       I = Bound;
>     }
>   }
>
> Bound == V.end() and that crashes at
>
>   segregate(&*I, &*Bound, Eq);
>
> Have next values for V:
> +               [0]     0x0096f698
> {RelocSections={Val={Val={Value=0x00000000 } } }
> OutSecOff=0x0000000000000000 GroupId=0x8000000055626995 }
> +               [1]     0x0096f6c8
> {RelocSections={Val={Val={Value=0x00000000 } } }
> OutSecOff=0x0000000000000000 GroupId=0x8000000055626995 }
> +               [2]     0x0096f668
> {RelocSections={Val={Val={Value=0x00000000 } } }
> OutSecOff=0x0000000000000000 GroupId=0x80000000af442220 }
> Head->GroupId ==        0x8000000055626995
>
> at first iteration it sets I to V[2]. Then on next one finds nothing,
> because I + 1 is already == E.
> If I add next after "auto Bound ="
>
>   if (Bound == V.end())
>     return;
>
> all tests pass for me.
>
>
> http://reviews.llvm.org/D17529
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160226/ca3bf76e/attachment.html>


More information about the llvm-commits mailing list