public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13730] New: Calls through function pointer at -fpic not optimized to call through PLT when possible
@ 2004-01-18 18:10 jakub at gcc dot gnu dot org
  2004-01-18 18:14 ` [Bug optimization/13730] " pinskia at gcc dot gnu dot org
  2004-07-18  4:11 ` [Bug rtl-optimization/13730] " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2004-01-18 18:10 UTC (permalink / raw)
  To: gcc-bugs

/* { 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug optimization/13730] Calls through function pointer at -fpic not optimized to call through PLT when possible
  2004-01-18 18:10 [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
@ 2004-01-18 18:14 ` pinskia at gcc dot gnu dot org
  2004-07-18  4:11 ` [Bug rtl-optimization/13730] " pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-18 18:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-18 18:14 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-18 18:14:30
               date|                            |


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug rtl-optimization/13730] Calls through function pointer at -fpic not optimized to call through PLT when possible
  2004-01-18 18:10 [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
  2004-01-18 18:14 ` [Bug optimization/13730] " pinskia at gcc dot gnu dot org
@ 2004-07-18  4:11 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-18  4:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-18 04:11 -------
It is a direct call now on the mainline:
bar:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        call    __i686.get_pc_thunk.bx
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        subl    $4, %esp
        call    baz@PLT
        popl    %eax
        popl    %ebx
        popl    %ebp
        ret

Which is good as you with -fpic I see as there no way to get sibcalling with -fpic (even with a direct 
call).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-18  4:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-18 18:10 [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
2004-01-18 18:14 ` [Bug optimization/13730] " pinskia at gcc dot gnu dot org
2004-07-18  4:11 ` [Bug rtl-optimization/13730] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).