public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47685] New: Tail call doesn't work for thumb2
@ 2011-02-10 18:30 alexandre.nunes at gmail dot com
  2011-02-10 18:43 ` [Bug c/47685] " alexandre.nunes at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: alexandre.nunes at gmail dot com @ 2011-02-10 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Tail call doesn't work for thumb2
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: alexandre.nunes@gmail.com


Created attachment 23298
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23298
testcase.

When compiling the attached test program for i.e. -mcpu=cortex-a9 -marm the
tail call mechanism works correctly ... if you replace -marm for -mthumb then
the result is a traditional stack frame, for which i couldn't find any switches
to turn it off.

For example, this was taken from the example code for -mthumb:


func_c:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        push    {lr}
        movs    r3, #33
        bl      func_a
        pop     {pc}
        .size   func_c, .-func_c

And this for -marm:


func_c:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        mov     r3, #33
        b       func_a
        .size   func_c, .-func_c


This is more relevant for example to -mcpu=cortex-m3 where we have no ram to
waste.


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

* [Bug c/47685] Tail call doesn't work for thumb2
  2011-02-10 18:30 [Bug c/47685] New: Tail call doesn't work for thumb2 alexandre.nunes at gmail dot com
@ 2011-02-10 18:43 ` alexandre.nunes at gmail dot com
  2011-02-27 23:34 ` [Bug target/47685] " ramana at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: alexandre.nunes at gmail dot com @ 2011-02-10 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alexandre Pereira Nunes <alexandre.nunes at gmail dot com> 2011-02-10 18:30:48 UTC ---
It also happens on 4.4.5


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

* [Bug target/47685] Tail call doesn't work for thumb2
  2011-02-10 18:30 [Bug c/47685] New: Tail call doesn't work for thumb2 alexandre.nunes at gmail dot com
  2011-02-10 18:43 ` [Bug c/47685] " alexandre.nunes at gmail dot com
@ 2011-02-27 23:34 ` ramana at gcc dot gnu.org
  2011-02-28 20:28 ` alexandre.nunes at gmail dot com
  2011-02-28 20:30 ` alexandre.nunes at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-02-27 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ramana at gcc dot gnu.org
         Resolution|                            |WONTFIX

--- Comment #2 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-02-27 23:27:11 UTC ---
This has been fixed on trunk and will be in the 4.6.0 release. 

With this commit

http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00725.html

cheers
Ramana


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

* [Bug target/47685] Tail call doesn't work for thumb2
  2011-02-10 18:30 [Bug c/47685] New: Tail call doesn't work for thumb2 alexandre.nunes at gmail dot com
  2011-02-10 18:43 ` [Bug c/47685] " alexandre.nunes at gmail dot com
  2011-02-27 23:34 ` [Bug target/47685] " ramana at gcc dot gnu.org
@ 2011-02-28 20:28 ` alexandre.nunes at gmail dot com
  2011-02-28 20:30 ` alexandre.nunes at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: alexandre.nunes at gmail dot com @ 2011-02-28 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alexandre Pereira Nunes <alexandre.nunes at gmail dot com> 2011-02-28 20:25:50 UTC ---
Created attachment 23496
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23496
Patch from the trunk, which I'm testing against 4.5.x


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

* [Bug target/47685] Tail call doesn't work for thumb2
  2011-02-10 18:30 [Bug c/47685] New: Tail call doesn't work for thumb2 alexandre.nunes at gmail dot com
                   ` (2 preceding siblings ...)
  2011-02-28 20:28 ` alexandre.nunes at gmail dot com
@ 2011-02-28 20:30 ` alexandre.nunes at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: alexandre.nunes at gmail dot com @ 2011-02-28 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alexandre Pereira Nunes <alexandre.nunes at gmail dot com> 2011-02-28 20:27:00 UTC ---
(In reply to comment #2)
> This has been fixed on trunk and will be in the 4.6.0 release. 
> 
> With this commit
> 
> http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00725.html
> 
> cheers
> Ramana


Thanks,

These changes were non-intrusive, so I've applied them to my 4.5.2 toolchain
and it simply "works for me".

Cheers,

Alexandre


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

end of thread, other threads:[~2011-02-28 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 18:30 [Bug c/47685] New: Tail call doesn't work for thumb2 alexandre.nunes at gmail dot com
2011-02-10 18:43 ` [Bug c/47685] " alexandre.nunes at gmail dot com
2011-02-27 23:34 ` [Bug target/47685] " ramana at gcc dot gnu.org
2011-02-28 20:28 ` alexandre.nunes at gmail dot com
2011-02-28 20:30 ` alexandre.nunes at gmail dot com

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