This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/42433] -Os generates wrong code when stdcall function with 3+ arguments does double tail call via function pointer.
- From: "congruwer at yahoo dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Dec 2009 10:57:51 -0000
- Subject: [Bug target/42433] -Os generates wrong code when stdcall function with 3+ arguments does double tail call via function pointer.
- References: <bug-42433-18586@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from congruwer at yahoo dot co dot uk 2009-12-19 10:57 -------
(In reply to comment #1)
> First can you try a newer GCC since 3.4.x is no longer supported.
I do apologize - the updater never notified me so I just assumed I was using
the latest stable release. I have updated and the problem appears to be fixed.
For reference, the new output is:
======================================================================
.file "bug.cpp"
.intel_syntax noprefix
.text
.globl __Z1Xiii@12
.def __Z1Xiii@12; .scl 2; .type 32; .endef
__Z1Xiii@12:
LFB0:
push ebx
LCFI0:
sub esp, 8
LCFI1:
mov ebx, DWORD PTR [esp+16]
mov edx, DWORD PTR [esp+20]
mov ecx, DWORD PTR [esp+24]
test ebx, ebx
mov eax, DWORD PTR _P
jne L4
mov DWORD PTR [esp+24], ecx
mov DWORD PTR [esp+20], edx
mov DWORD PTR [esp+16], 42
L4:
pop edx
pop ecx
pop ebx
jmp eax
LFE0:
.globl _P
.bss
.align 4
_P:
.space 4
======================================================================
As you can see, this code is correct, if perhaps a bit more convoluted than
strictly necessary. (Same as above + it allocates stack space that it never
uses. But it's correct and therefore, this bug will be deemed fixed.) Many many
thanks for your quick response and my deepest apologies for unwittingly wasting
your time.
--
congruwer at yahoo dot co dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42433