Hi all, I found this thread (Jan 2001), but not sure what is the outcome of it. http://gcc.gnu.org/ml/gcc/2001-01/msg00138.html Currently (4.4.1), inlining prevents tail-call optimization. Is it going to be fixed ? Am I missing something ? Test case. gcc version 4.4.1 (GCC) Target: x86_64-unknown-linux-gnu Thread model: posix Source. int f (int *p, unsigned n) { int s = 0; while (n--) s+=*(p++); return s; } int g (int *p, unsigned n0, unsigned n1) { return f(p+n0, n1-n0); } Assembly generated by gcc -Os a.c 0000000000400454 <f>: 400454: 31 c0 xor %eax,%eax 400456: eb 08 jmp 400460 <f+0xc> 400458: 03 07 add (%rdi),%eax 40045a: ff ce dec %esi 40045c: 48 83 c7 04 add $0x4,%rdi 400460: 85 f6 test %esi,%esi 400462: 75 f4 jne 400458 <f+0x4> 400464: c3 retq 0000000000400465 <g>: 400465: 29 f2 sub %esi,%edx 400467: 89 f6 mov %esi,%esi 400469: 31 c0 xor %eax,%eax 40046b: 48 8d 0c b7 lea (%rdi,%rsi,4),%rcx 40046f: eb 08 jmp 400479 <g+0x14> 400471: 03 01 add (%rcx),%eax 400473: ff ca dec %edx 400475: 48 83 c1 04 add $0x4,%rcx 400479: 85 d2 test %edx,%edx 40047b: 75 f4 jne 400471 <g+0xc> 40047d: c3 retq Assembly generated by gcc -Os -fno-inline a.c I prefer this one (note -Os) 0000000000400454 <f>: 400454: 31 c0 xor %eax,%eax 400456: eb 08 jmp 400460 <f+0xc> 400458: 03 07 add (%rdi),%eax 40045a: ff ce dec %esi 40045c: 48 83 c7 04 add $0x4,%rdi 400460: 85 f6 test %esi,%esi 400462: 75 f4 jne 400458 <f+0x4> 400464: c3 retq 0000000000400465 <g>: 400465: 29 f2 sub %esi,%edx 400467: 89 f6 mov %esi,%esi 400469: 48 8d 3c b7 lea (%rdi,%rsi,4),%rdi 40046d: 89 d6 mov %edx,%esi 40046f: e9 e0 ff ff ff jmpq 400454 <f> Thanks. === Felix Shvaiger fshvaige@xxxxxxxxx