>From http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9079 now we get:

        .file   "foo.c"
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string "Hello World.\n"
        .text
        .p2align 4,,15
        .type   funk, @function
funk:
        pushl   %ebp
        movl    $.LC0, %eax
        movl    %esp, %ebp
        popl    %ebp
        ret
        .size   funk, .-funk
        .section        .rodata.str1.1
.LC1:
        .string "Hello World."
        .text
        .p2align 4,,15
.globl main
        .type   main, @function
main:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ecx
        subl    $4, %esp
        movl    $.LC1, (%esp)
        call    puts
        addl    $4, %esp
        popl    %ecx
        popl    %ebp
        leal    -4(%ecx), %esp
        ret
        .size   main, .-main
        .ident  "GCC: (Ubuntu 4.3.0-1ubuntu1) 4.3.0"
        .section        .note.GNU-stack,"",@progbits

Note funk (a static function) is unused, and successfully inlined, but still
omitted.  Replicated on powerpc as well, so not x86-specific.


-- 
           Summary: Inlined function via function pointer emitted
                    unnecessarily
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rusty at rustcorp dot com dot au
 GCC build triplet: i386-linux-gnu-gcc-4.1
  GCC host triplet: i386-linux-gnu-gcc-4.1
GCC target triplet: i386-linux-gnu-gcc-4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35728

Reply via email to