浏览代码

FFI: Insert no-op type conversion for pointer to integer cast.

Mike Pall 12 年之前
父节点
当前提交
890754ee27
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/lj_crecord.c

+ 4 - 0
src/lj_crecord.c

@@ -453,6 +453,10 @@ static TRef crec_ct_ct(jit_State *J, CType *d, CType *s, TRef dp, TRef sp,
     sinfo = CTINFO(CT_NUM, CTF_UNSIGNED);
     ssize = CTSIZE_PTR;
     st = IRT_UINTP;
+    if (((dsize ^ ssize) & 8) == 0) {  /* Must insert no-op type conversion. */
+      sp = emitconv(sp, dsize < 4 ? IRT_INT : dt, IRT_PTR, 0);
+      goto xstore;
+    }
     goto conv_I_I;
 
   /* Destination is a floating-point number. */