https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67327
Bug ID: 67327 Summary: Missed tail call with __noreturn__ attribute Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-tools-1 tmp]$ cat x.c extern void xxx (void) __attribute__ ((__noreturn__)); void foo (int len) { if (len) xxx (); } [hjl@gnu-tools-1 tmp]$ gcc -S -O2 x.c [hjl@gnu-tools-1 tmp]$ cat x.s .file "x.c" .section .text.unlikely,"ax",@progbits .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc testl %edi, %edi jne .L6 rep ret .L6: pushq %rax .cfi_def_cfa_offset 16 call xxx .cfi_endproc .LFE0: .size foo, .-foo .section .text.unlikely .LCOLDE0: .text .LHOTE0: .ident "GCC: (GNU) 5.2.1 20150716 (Red Hat 5.2.1-1)" .section .note.GNU-stack,"",@progbits [hjl@gnu-tools-1 tmp]$