http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39275
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-21 07:20:42 UTC --- Here is a reduced testcase: struct vector { char *_M_start; char *_M_finish; }; struct LoopBase { static LoopBase *f(); LoopBase *ParentLoop; vector SubLoops; ~LoopBase() { for (int i = 0, e = SubLoops._M_finish - SubLoops._M_start; i != e; ++i) delete f(); } }; void deleteLoopFromQueue(LoopBase *L, int b) { if (L->ParentLoop) while (L->SubLoops._M_start != L->SubLoops._M_finish)return; else while (L->SubLoops._M_start != L->SubLoops._M_finish)return; delete L; } --- CUT --- The delete loop is actually an empty loop but the tree level does not see that for some reason: # prephitmp.36_112 = PHI <prephitmp.36_6(4), prephitmp.36_3(3)> # prephitmp.36_21 = PHI <prephitmp.36_6(4), prephitmp.36_3(3)> D.2385_15 = (long int) prephitmp.36_21; D.2387_17 = (long int) prephitmp.36_112; Those PHIs are the same.