The following two functions should be the same: int foo(int a) { int i; for (i=0; i<200; i++) { a = a + 5; } return a; } int foo(int a) { int i; for (i=0; i<200; i++) ; return a+5*200; }
The RTL optimizers catch this on ppc but not on x86. -- Summary: missed optimization in loop Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: missed-optimization, TREE Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22325