[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#366377: gcc-4.1: does not optimize sibling calls with args



Package: gcc-4.1
Version: 4.1.0-2
Severity: normal

Trying to write an argument-passing tail call to another function
doesn't seem to get optimized with -foptimize-sibling-calls no matter
which other optimization options I turn on.  Example, to be run
through [gcc -foptimize-sibling-calls -O9 -S]:

  extern int foo(int x);
  int bar(void) { return foo(32); }

On i386 this compiles to

        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    $32, (%esp)
        call    foo
        leave
        ret

which doesn't correctly convert the call to foo into a tail call.

   ---> Drake Wilson

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.11
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcc-4.1 depends on:
ii  binutils             2.16.1cvs20051214-1 The GNU assembler, linker and bina
ii  cpp-4.1              4.1.0-2             The GNU C preprocessor
ii  gcc-4.1-base         4.1.0-2             The GNU Compiler Collection (base 
ii  libc6                2.3.6-7             GNU C Library: Shared libraries
ii  libgcc1              1:4.1.0-2           GCC support library

-- no debconf information



Reply to: