Created attachment 23298 [details] 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.
It also happens on 4.4.5
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
Created attachment 23496 [details] Patch from the trunk, which I'm testing against 4.5.x
(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