The following two function should produce the same asm because we can skip the second call to f: int f(void) __attribute__((const,pure));
int g(int i, int j) { int k = 0; if(i) k = f(); if (j) k = f(); return k; } int h(int i, int j) { int k = 0; if(i) k = f(); else if (j) k = f(); return k; } -- Summary: Missed pure/const optimization 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=19827