public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14909] New: tail call optimization does not work with indirect call
@ 2004-04-10 18:16 cesarb at nitnet dot com dot br
  2004-04-10 18:16 ` [Bug optimization/14909] " pinskia at gcc dot gnu dot org
  2004-04-10 18:21 ` gdr at integrable-solutions dot net
  0 siblings, 2 replies; 3+ messages in thread
From: cesarb at nitnet dot com dot br @ 2004-04-10 18:16 UTC (permalink / raw)
  To: gcc-bugs

(since I have nothing better to do, here's another sibcall bug)

When compiling:
void g(void (*f)(void)) { f(); }

With:
gcc -W -Wall -Os -fomit-frame-pointer -save-temps -c

The result is:
g:
        call    *4(%esp)
        ret

It should be:
g:
        jmp    *4(%esp)

The same happens when returning something other than void (my original testcase
used unsigned int).

Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040401)

-- 
           Summary: tail call optimization does not work with indirect call
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cesarb at nitnet dot com dot br
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug optimization/14909] tail call optimization does not work with indirect call
  2004-04-10 18:16 [Bug optimization/14909] New: tail call optimization does not work with indirect call cesarb at nitnet dot com dot br
@ 2004-04-10 18:16 ` pinskia at gcc dot gnu dot org
  2004-04-10 18:21 ` gdr at integrable-solutions dot net
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-10 18:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-10 16:19 -------
This is already fixed in 3.4.0:
g:
        movl    4(%esp), %ecx
        jmp     *%ecx

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


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

* [Bug optimization/14909] tail call optimization does not work with indirect call
  2004-04-10 18:16 [Bug optimization/14909] New: tail call optimization does not work with indirect call cesarb at nitnet dot com dot br
  2004-04-10 18:16 ` [Bug optimization/14909] " pinskia at gcc dot gnu dot org
@ 2004-04-10 18:21 ` gdr at integrable-solutions dot net
  1 sibling, 0 replies; 3+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-10 18:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-10 16:20 -------
Subject: Re:  New: tail call optimization does not work with indirect call

"cesarb at nitnet dot com dot br" <gcc-bugzilla@gcc.gnu.org> writes:

| (since I have nothing better to do, here's another sibcall bug)
| 
| When compiling:
| void g(void (*f)(void)) { f(); }
| 
| With:
| gcc -W -Wall -Os -fomit-frame-pointer -save-temps -c
| 
| The result is:
| g:
|         call    *4(%esp)
|         ret
| 
| It should be:
| g:
|         jmp    *4(%esp)


Is that a wrong-code generation?  I don't think so.
I would suggest to close the PR.

-- Gaby


-- 


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


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

end of thread, other threads:[~2004-04-10 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-10 18:16 [Bug optimization/14909] New: tail call optimization does not work with indirect call cesarb at nitnet dot com dot br
2004-04-10 18:16 ` [Bug optimization/14909] " pinskia at gcc dot gnu dot org
2004-04-10 18:21 ` gdr at integrable-solutions dot net

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).