[Bug optimization/13730] New: Calls through function pointer at -fpic not optimized to call through PLT when possible

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Jan 18 18:10:00 GMT 2004


/* { dg-options "-O2 -fpic" } */
/* { dg-do compile } */
extern inline void
foo (void (*p) (void))
{
  p ();
}

void baz (void);
void bar (void)
{
  foo (baz);
}

While at -O2 -fno-pic the call is optimized into jmp baz (or call baz if
-fno-optimize-sibling-calls), with -O2 -fpic the result is:
call    *baz@GOT(%ebx)
(similarly on amd64).
I can see this in both 3.3.x and 3.4.

-- 
           Summary: Calls through function pointer at -fpic not optimized to
                    call through PLT when possible
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,rth at redhat dot com
GCC target triplet: i386-redhat-linux


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



More information about the Gcc-bugs mailing list