https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89353
Bug ID: 89353 Summary: Unnecessary ENDBR with -mmanual-endbr Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-mic-2 gcc]$ cat x.c #ifdef FOO __attribute__ ((cf_check)) #endif int test(int* val) { int status = 99; if((val == 0)) { status = 22; goto end; } extern int x; *val = x; status = 0; end: return status; } [hjl@gnu-mic-2 gcc]$ ./xgcc -B./ -m32 -O2 -fcf-protection x.c -S -mmanual-endbr [hjl@gnu-mic-2 gcc]$ cat x.s .file "x.c" .text .p2align 4 .globl test .type test, @function test: .LFB0: .cfi_startproc movl 4(%esp), %eax testl %eax, %eax je .L3 movl x, %edx movl %edx, (%eax) xorl %eax, %eax ret .p2align 4,,10 .p2align 3 .L3: .L2: endbr32 <<<<<<<< This should be there. movl $22, %eax ret .cfi_endproc .LFE0: .size test, .-test .ident "GCC: (GNU) 9.0.1 20190214 (experimental)" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 4 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 4 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 4 4: [hjl@gnu-mic-2 gcc]$