This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/65753] [i386] Incorrect tail call inhibition logic on i386 (32-bit)
- From: "amonakov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Apr 2015 17:25:54 +0000
- Subject: [Bug target/65753] [i386] Incorrect tail call inhibition logic on i386 (32-bit)
- Auto-submitted: auto-generated
- References: <bug-65753-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65753
--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Example testcase:
void *lookup_f(void);
void g()
{
void (*f)(void) = lookup_f();
f();
}
With -O2 -fPIC, on x86-64 GCC produces the desired tail call:
g:
subq $8, %rsp
call lookup_f@PLT
addq $8, %rsp
jmp *%rax
However for i386 the tail call is not produced:
g:
pushl %ebx
call __x86.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
subl $8, %esp
call lookup_f@PLT
call *%eax
addl $8, %esp
popl %ebx
ret