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]

Passing 64-bit function arguments to assembler


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
  4004a5:    bf 33 33 00 00           mov    edi,0x3333
  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.

Attachment: a.out.objdump
Description: Text document

Attachment: function.S
Description: Text document

#include <stdint.h>

extern void function(uint64_t, uint64_t);

int main()
{
	function(0x3333, 0x4444);

	return;
}


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