Bug in LowerIntrinsics::PerformDefaultLowering ?

Hi,

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?

-Y.

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

Oops, sorry for that! You're absolutely right! :blush: