https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78104
Bug ID: 78104 Summary: optimizer doesn't grok C++ new/delete yet Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org Target Milestone: --- A simple example: int main() { int *ob = new int(); delete ob; } clang optimizes it away: main: # @main xorl %eax, %eax retq gcc doesn't: main: subq $8, %rsp movl $4, %edi call operator new(unsigned long) movl $4, %esi movl $0, (%rax) movq %rax, %rdi call operator delete(void*, unsigned long) xorl %eax, %eax addq $8, %rsp ret