I found this while looking into PR 8361 for missed optimization. The following two programs should produce the same asm: int f(int k, int i1, int j1) { int *f1; if(k) f1 = &i1; else f1 = &j1; return *f1; } int g(int k, int i1, int j1) { int *f1; if(k) return i1; else return j1; }
-- Summary: missed optimization with ifs and deferencing Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization 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=19431