https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121694
Bug ID: 121694 Summary: Redundant TLSCALL Product: gcc Version: 16.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: --- Target: x86-64 [hjl@gnu-zen4-1 pr121668]$ cat x.c typedef int caml_domain_state; thread_local caml_domain_state caml_state; void caml_empty_mark_stack () { while (caml_state) caml_state = 0; } [hjl@gnu-zen4-1 pr121668]$ /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -Og -fPIC -mtls-dialect=gnu2 -S x.c [hjl@gnu-zen4-1 pr121668]$ cat x.s .file "x.c" .text .globl caml_empty_mark_stack .type caml_empty_mark_stack, @function caml_empty_mark_stack: .LFB0: .cfi_startproc subq $8, %rsp .cfi_def_cfa_offset 16 jmp .L2 .p2align 5 .L3: leaq caml_state@TLSDESC(%rip), %rax call *caml_state@TLSCALL(%rax) movl $0, %fs:(%rax) .L2: leaq caml_state@TLSDESC(%rip), %rax call *caml_state@TLSCALL(%rax) cmpl $0, %fs:(%rax) jne .L3 addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE0: .size caml_empty_mark_stack, .-caml_empty_mark_stack .globl caml_state .section .tbss,"awT",@nobits .align 4 .type caml_state, @object .size caml_state, 4 caml_state: .zero 4 .ident "GCC: (GNU) 16.0.0 20250825 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-zen4-1 pr121668]$ There are 2 leaq caml_state@TLSDESC(%rip), %rax call *caml_state@TLSCALL(%rax)