void foo(void) { int *p = new int; delete *p; } storage allocation should be changed from heap to stack allocation if possible and of known (low) size. This way allocation can be optimized away completely in some cases. Such opportunities are often exposed by inlining of libstdc++ container operations.
-- Summary: Should promote heap allocation to stack allocation Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26387