https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110919
--- Comment #1 from Scherrer Svenja <scherrer.sv at gmail dot com> --- My apologies, the assembly above is incomplete. The following shows the bug gcc-87b0749cfb9406790b108208b466cf507ae3c431 -O3 case.c -S -o case.s --------- OUTPUT --------- .file "case.c" .text .p2align 4 .type g, @function g: .LFB3: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movl %esi, %ebx testw %di, %di jne .L2 xorl %eax, %eax testl %esi, %esi sete %al .L3: movl e(%rip), %edx cmpl %eax, %edx sete %cl testl %edx, %edx setne %dl testb %dl, %cl je .L1 testl %eax, %eax je .L15 .L1: popq %rbx .cfi_remember_state .cfi_def_cfa_offset 8 ret .L2: .cfi_restore_state call bar151_ testl %ebx, %ebx je .L1 call bar162_ xorl %eax, %eax jmp .L3 .L15: popq %rbx .cfi_def_cfa_offset 8 jmp foo .cfi_endproc .LFE3: .size g, .-g .section .text.startup,"ax",@progbits .p2align 4 .globl main .type main, @function main: .LFB4: .cfi_startproc subq $8, %rsp .cfi_def_cfa_offset 16 movl $4, %esi xorl %edi, %edi call g xorl %esi, %esi xorl %edi, %edi call g movl $-1, %esi xorl %edi, %edi call g xorl %eax, %eax addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE4: .size main, .-main .local e .comm e,4,4 .ident "GCC: (GNU) 14.0.0 20230806 (experimental)" .section .note.GNU-stack,"",@progbits ---------- END OUTPUT --------- ----------------------------------------------------------------------- gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O3 case.c -S -o case.s --------- OUTPUT --------- .file "case.c" .text .p2align 4 .type g, @function g: .LFB3: .cfi_startproc testw %di, %di jne .L11 ret .L11: pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movl %esi, %ebx call bar151_ testl %ebx, %ebx je .L1 popq %rbx .cfi_remember_state .cfi_restore 3 .cfi_def_cfa_offset 8 jmp bar162_ .L1: .cfi_restore_state popq %rbx .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE3: .size g, .-g .section .text.startup,"ax",@progbits .p2align 4 .globl main .type main, @function main: .LFB4: .cfi_startproc subq $8, %rsp .cfi_def_cfa_offset 16 movl $4, %esi xorl %edi, %edi call g xorl %esi, %esi xorl %edi, %edi call g movl $-1, %esi xorl %edi, %edi call g xorl %eax, %eax addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE4: .size main, .-main .ident "GCC: (GNU) 13.1.0" .section .note.GNU-stack,"",@progbits ---------- END OUTPUT ---------