https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47815
Adam Warner <adam at consulting dot net.nz> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Adam Warner <adam at consulting dot net.nz> ---
(In reply to Eric Gallager from comment #4)
> Is this still an issue with newer versions of gcc?
I'm delighted to inform you the regression is resolved. Jumps instead of calls
are generated and optimisation for size is significantly improved (from 18
bytes down to 10 bytes due to the elimination of a duplicate xor instruction
and the use of smaller relative jump instructions):
$ gcc-snapshot.sh --version
gcc (Debian 20180322-1) 8.0.1 20180322 (experimental) [trunk revision 258755]
...
$ gcc-snapshot.sh -Os tail_call_regression.c && objdump -d -m i386:x86-64 a.out
|less
...
0000000000400576 <make_tail_calls>:
400576: 31 c0 xor %eax,%eax
400578: 85 ff test %edi,%edi
40057a: 74 02 je 40057e <make_tail_calls+0x8>
40057c: eb a8 jmp 400526 <tail_call0>
40057e: eb ce jmp 40054e <tail_call1>
...