[LLVMdev] Bug in LowerIntrinsics::PerformDefaultLowering ?

David Tweed David.Tweed at arm.com
Thu Oct 18 05:45:43 PDT 2012


|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.

Cheers,
Dave







More information about the llvm-dev mailing list