This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Passing 64-bit function arguments to assembler


On Fri, Oct 12, 2012 at 1:55 AM, Mischa Baars <mjbaars1977@gmail.com> wrote:
> Hi,
>
> Here's a possible bug in the compiler:
>
> As can be seen from the objdump output, 64-bit arguments are passed in
> 32-bit registers
>
> 000000000040049c <main>:
>   40049c:    55                       push   rbp
>   40049d:    48 89 e5                 mov    rbp,rsp
>   4004a0:    be 44 44 00 00           mov    esi,0x4444

this is the same as
mov rsi, 0x4444

As all instructions which act on the lower 32bit part of the register
are zero extended into the full 64bit register.


>   4004a5:    bf 33 33 00 00           mov    edi,0x3333

Likewise.

Thanks,
Andrew Pinski

PS this question is more relevant to the gcc-help mailing list than the gcc one.

>   4004aa:    e8 05 00 00 00           call   4004b4 <function>
>   4004af:    90                       nop
>   4004b0:    5d                       pop    rbp
>   4004b1:    c3                       ret
>   4004b2:    66 90                    xchg   ax,ax
>
> also the opcodes on line 4004AF and 4004B2 seem obsolete.



>
> Best Regards,
> Mischa.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]