http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519
--- Comment #5 from Yukhin Kirill <kirill.yukhin at intel dot com> 2011-06-29 12:24:25 UTC --- Problem here is that GCC incorrectly stores arguments to stack in case of tail-call opt. Here is snippet movl 40(%esp), %eax movl %eax, 28(%esp) movl 36(%esp), %esi movl %esi, 24(%esp) movl 32(%esp), %esi movl %esi, 20(%esp) movl %eax, 16(%esp) Argument from 28(%esp) is not copied to 28(%esp) at all. Correct sequence must be (semantically) like that: movl 40(%esp), %esi ; <----- Use esi to move memory movl 28(%esp), %eax ; <----- Save overlapping value movl %esi, 28(%esp) movl 36(%esp), %esi movl %esi, 24(%esp) movl 32(%esp), %esi movl %esi, 20(%esp) movl %eax, 16(%esp) ; <----- Store saved value Working toward the patch