https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101892
Feiyang Huang <220255623 at seu dot edu.cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |220255623 at seu dot edu.cn
--- Comment #1 from Feiyang Huang <220255623 at seu dot edu.cn> ---
This is still reproducible on the reviewed GCC 17 snapshot.
Tested with:
gcc version 17.0.0 20260531 (experimental)
Target: x86_64-pc-linux-gnu
Command:
gcc -O2 -fzero-call-used-regs=all -S trigger.i
Exit status is 0 with no diagnostics. The attached trigger.i produces:
f_tail:
call h@PLT
movl %eax, %edi
jmp g@PLT
# no xor/pxor/fldz cleanup before the sibling jump
f_ret:
...
fldz
...
xorl %edx, %edx
xorl %ecx, %ecx
xorl %esi, %esi
xorl %edi, %edi
pxor %xmm0, %xmm0
...
ret
Adding -fno-optimize-sibling-calls changes f_tail to a normal call/ret
and emits the full cleanup sequence before ret. GCC 13.3.0 reproduces
the same behavior.
The current source still contains the relevant predicate in
pass_zero_call_used_regs::execute:
if (JUMP_P (insn) && ANY_RETURN_P (JUMP_LABEL (insn)))
gen_call_used_regs_seq (insn, zero_regs_type);
A sibling call terminates in a CALL_INSN with SIBLING_CALL_P, so it does
not match. The predicate is also unchanged in current master and the
current gcc-15 and gcc-16 source branches.
Could this be confirmed? Is the intended behavior to disable sibling-call
optimization while -fzero-call-used-regs is active, or to document this
combination as unsupported?