This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/7005: Sibling and tail recursive calls optimisation with -fomit-frame-pointer: strange code generated.


>Number:         7005
>Category:       optimization
>Synopsis:       Sibling and tail recursive calls optimisation with -fomit-frame-pointer: strange code generated.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 12 06:16:04 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     fshvaige@cisco.com
>Release:        3.1 and 3.1 20020510 (prerelease)
>Organization:
>Environment:

>Description:
File test2.c:

int f1 (void);
int f2 (void) {
  return f1 ();
}

i686 -Os (best code):

f2:
  jmp     f1

i686 -O2/-O3 (Ooops):

f2:
  subl  $12, %esp
  addl  $12, %esp
  jmp f1

PowerPC -Os/-O2/-O3 (Ooops):

f2:
  stwu 1,-8(1)
  mflr 0
  stw 0,12(1)
  bl f1 
  lwz 0,12(1)
  addi 1,1,8 
  mtlr 0
  blr   
>How-To-Repeat:
gcc -S -Os test2.c -Wall -fomit-frame-pointer
gcc -S -O2 test2.c -Wall -fomit-frame-pointer
gcc -S -O3 test2.c -Wall -fomit-frame-pointer
ppc-eabi-gcc -S -Os test2.c -Wall -fomit-frame-pointer
ppc-eabi-gcc -S -O2 test2.c -Wall -fomit-frame-pointer
ppc-eabi-gcc -S -O3 test2.c -Wall -fomit-frame-pointer
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]