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: unassig...@gcc.gnu.org ReportedBy: alexandre.nu...@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.