optimization/9383: -fomit-frame-pointer has no effect on nested functions
fshvaige@cisco.com
fshvaige@cisco.com
Tue Jan 21 12:46:00 GMT 2003
>Number: 9383
>Category: optimization
>Synopsis: -fomit-frame-pointer has no effect on nested functions
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Tue Jan 21 12:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: fshvaige@cisco.com
>Release: 3.2.1
>Organization:
>Environment:
Configured with: ../gcc-3.2.1/configure --prefix=/home/crossGCC/native --exec_prefix=/home/crossGCC/native --with-local-prefix=/home/crossGCC/native --enable-languages=c,c++ -v
and
Configured with: ../gcc-3.2.1/configure --with-newlib --enable-target-optspace --target=ppc-elf --prefix=/home/crossGCC/ppc-elf --exec_prefix=/home/crossGCC/ppc-elf --with-local-prefix=/home/crossGCC/ppc-elf --program-prefix=ppc-elf- --enable-languages=c,c++ -v
>Description:
File main.c:
extern int h (int func (int));
int g2 (int c) {
return c;
}
int f (int a, int b) {
int g1 (int c) {
return c;
}
return h (g1);
}
Command:
gcc -S -Os -fomit-frame-pointer main.c
File main.s:
.file "main.c"
.text
.globl g2
.type g2,@function
g2:
movl 4(%esp), %eax
ret
.Lfe1:
.size g2,.Lfe1-g2
.type g1.0,@function
g1.0:
pushl %ecx
movl 8(%esp), %eax
popl %edx
ret
.Lfe2:
.size g1.0,.Lfe2-g1.0
.globl f
.type f,@function
f:
subl $12, %esp
leal 12(%esp), %ecx
movl $g1.0+2, %edx
movb $-71, (%esp)
movl %esp, %eax
subl %ecx, %edx
movl %ecx, 1(%esp)
movb $-23, 5(%esp)
movl %edx, 6(%esp)
pushl %eax
call h
addl $16, %esp
ret
.Lfe3:
.size f,.Lfe3-f
.ident "GCC: (GNU) 3.2.1"
Command:
ppc-elf-gcc -S -Os -fomit-frame-pointer main.c
File main.s:
.file "main.c"
.section ".text"
.align 2
.globl g2
.type g2,@function
g2:
blr
.Lfe1:
.size g2,.Lfe1-g2
.align 2
.type g1.0,@function
g1.0:
stwu 1,-16(1)
addi 1,1,16
blr
.Lfe2:
.size g1.0,.Lfe2-g1.0
.globl __trampoline_setup
.align 2
.globl f
.type f,@function
f:
stwu 1,-64(1)
lis 5,g1.0@ha
mflr 0
la 5,g1.0@l(5)
addi 3,1,8
li 4,40
mr 6,3
stw 0,68(1)
crxor 6,6,6
bl __trampoline_setup
addi 3,1,8
bl h
lwz 0,68(1)
addi 1,1,64
mtlr 0
blr
.Lfe3:
.size f,.Lfe3-f
.ident "GCC: (GNU) 3.2.1"
Note:
Pay attention to difference between codes generated for function g1() and g2().
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list