I built the attached test case with -O2 -save-temps -funsafe-loop-optimizations.
The entire call to a() should be optimized away if the loop optimization works right, but it's not. The assembly shows these three useless instructions left in a(): a: pushl %ebp movl %esp, %ebp popl %ebp ret -- Summary: function call not optimized away after unsafe-loop- optimizations Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tkho at ucla dot edu CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i686-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414