[LLVMdev] Fwd: Improper Function::iterator increment

David Blaikie dblaikie at gmail.com
Sun Feb 8 08:55:20 PST 2015


This may be difficult yo reproduce or debug without a more complete (though
preferably minimal) test case.
On Feb 8, 2015 8:31 AM, "Pranav Kant" <pranav913 at gmail.com> wrote:

> void Wave::init (const Function &F){
>     Function::const_iterator ie = F.end();
>     outs() << ie << "\n\n";
>     for (Function::const_iterator I = F.begin(), IE = F.end(); I != IE;
> I++, K++){
>        outs() << I << "\n";
>        // some manipulation with I
>     }
> }
>
> I used the above shown function in my pass in LLVM 3.4.2 and it used to
> work fine but when I am compiling this pass with 3.5.0, this is a never
> ending loop. Can someone please suggest me what can be wrong here ?
>
> Upon some debugging, I found out that const_iterator I never becomes equal
> to IE, rather it goes past IE when incremented and hence loop never ends.
>
> Following is the output upon executing above code.
>
> 0x2e08248 <- address of ie
> 0x2e16630 <- address of I initially
> 0x2e08250 <- incremented I
> 0x2e165e0
> 0x2e16630
> 0x2e08250
> 0x2e165e0
> 0x2e16630
> 0x2e08250
>
>
>
> --
> Regards,
> Pranav Kant,
> Department of Computer Science
> National Institute of Technology Hamirpur
> http://pricked.in/
>
>
>
> --
> Regards,
> Pranav Kant,
> Department of Computer Science
> National Institute of Technology Hamirpur
> http://pricked.in/
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150208/440f5d75/attachment.html>


More information about the llvm-dev mailing list