The following function really should be compiled to an empty function (DSE should first remove the store and then free of a malloc with no change inbetween and we should remove both calls). void *malloc(__SIZE_TYPE__); void free(void*); int f(void) { char *i = malloc(1); *i = 1; free (i); }
This is something which is useful when we want to much higer level optimizations. -- Summary: Missing DSE/malloc/free 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=19831