https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71761
Bug ID: 71761 Summary: missing tailcall optimization Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Currently GCC doesn't optimize tailcall in the following function: struct token { char const* tok_start; char const* tok_end; int tok_type; unsigned identifier_hash; }; token f(); token g() { return f(); } Generated code: g(): pushq %rbx movq %rdi, %rbx call f() movq %rbx, %rax popq %rbx ret Expected: g(): jmp f()