[LLVMdev] Bug in LowerIntrinsics::PerformDefaultLowering ?

Yiannis Tsiouris gtsiour at softlab.ntua.gr
Thu Oct 18 06:36:28 PDT 2012


On 10/18/2012 03:45 PM, David Tweed wrote:
> |I noticed that in line 288-289 of lib/CodeGen/GCStrategy.cpp there is a
> |loop:
> 
> |> for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
> |>   for (BasicBlock::iterator II = BB->begin(), E = BB->end();
> |>                                                     II != E;) {
> 
> |E is used both for F.end() and for BB->end(). Is this intended?
> 
> Note that it's also being declared in the for header, so the inner E is shadowing the outer E (ie, they're separate variables). So it's not wrong per se, although I always compile with -Wshadow because problems when this happens are _really_ nasty to track down.
> 
Oops, sorry for that! You're absolutely right! :-$

-- 
Yiannis Tsiouris
Ph.D. student,
Software Engineering Laboratory,
National Technical University of Athens
WWW: http://www.softlab.ntua.gr/~gtsiour



More information about the llvm-dev mailing list