diff --git a/i386-asm.c b/i386-asm.c index 1d1ebcf..16b2e91 100644 --- a/i386-asm.c +++ b/i386-asm.c @@ -1493,7 +1493,8 @@ ST_FUNC void subst_asm_operand(CString *add_str, else if ((sv->type.t & VT_BTYPE) == VT_SHORT) size = 2; #ifdef TCC_TARGET_X86_64 - else if ((sv->type.t & VT_BTYPE) == VT_LLONG) + else if ((sv->type.t & VT_BTYPE) == VT_LLONG || + (sv->type.t & VT_BTYPE) == VT_PTR) size = 8; #endif else diff --git a/tests/tcctest.c b/tests/tcctest.c index 496de3a..22d9e88 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -2914,6 +2914,11 @@ void fancy_copy (unsigned *in, unsigned *out) asm volatile ("" : "=r" (*out) : "0" (*in)); } +void fancy_copy2 (unsigned *in, unsigned *out) +{ + asm volatile ("mov %0,(%1)" : : "r" (*in), "r" (out) : "memory"); +} + void asm_test(void) { char buf[128]; @@ -2987,6 +2992,9 @@ void asm_test(void) val = 43; fancy_copy (&val, &val2); printf ("fancycpy(%d)=%d\n", val, val2); + val = 44; + fancy_copy2 (&val, &val2); + printf ("fancycpy2(%d)=%d\n", val, val2); return; label1: goto label2;