Interesting regression in parameter passing (x86_64)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I recently noticed that gcc 9 introduced a strange push/pop pair in a
function that does nothing other than shift all arguments by one
position and transfer control to another function:

int func(int, int, int, int, int, int);
int caller(int a, int b, int c, int d, int e) { return func(0, a, b, c, d, e); }

pushq %r12
movl %r8d, %r9d
popq %r12
movl %ecx, %r8d
movl %edx, %ecx
movl %esi, %edx
movl %edi, %esi
xorl %edi, %edi
jmp func

Obviously, pushing and popping r12 serves no useful purpose, and gcc 8
does not produce it. It also disappears when a is used instead of the
constant 0 as the first argument. Where does this come from?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux