Compiling:
typedef unsigned int Cardinal;
typedef char *String;
typedef struct _WidgetRec *Widget;
typedef union _XEvent {
int type;
long pad[24];
} XEvent;
extern int SendMousePosition (Widget w, XEvent* event);
void
HandleIgnore(Widget w,
XEvent * event,
String * params ,
Cardinal *param_count )
{
(void) SendMousePosition(w, event);
}
with 4.0 and 4.1 -march=i686 -O2 generates: (the sdiff is shown)
.file "PR.i" .file
"PR.i"
.text .text
.p2align 2,,3 .p2align
2,,3
.globl HandleIgnore .globl
HandleIgnore
.type HandleIgnore, @function .type
HandleIgnore, @function
HandleIgnore: HandleIgnore:
pushl %ebp pushl
%ebp
movl %esp, %ebp movl
%esp, %ebp
> subl
$16, %esp
> pushl
12(%ebp)
> pushl
8(%ebp)
> call
SendMousePosition
> addl
$16, %esp
leave leave
jmp SendMousePosition | ret
.size HandleIgnore, .-HandleIgnore .size
HandleIgnore, .-HandleIgnore
.ident "GCC: (GNU) 4.0.1 20050727 (Red Hat 4.0.1-5)" | .ident
"GCC: (GNU) 4.1.0 20050727 (experimental)"
.section .note.GNU-stack,"",@progbits .section
.note.GNU-stack,"",@progbits
Note that 4.1 does not generate a jump to SendMousePosition, but a call.
This is one of the reasons for the code size regression in PR23153.
--
Summary: tail call optimization not performed
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23289