Merge branch 'master' of github.com:/libffi/libffi
diff --git a/src/moxie/ffi.c b/src/moxie/ffi.c
index 0846b27..21144e8 100644
--- a/src/moxie/ffi.c
+++ b/src/moxie/ffi.c
@@ -215,7 +215,18 @@
 	  break;
 	default:
 	  /* This is an 8-byte value.  */
-	  avalue[i] = ptr;
+	  if (ptr == (char *) &register_args[5])
+	    {
+	      /* The value is split across two locations */
+	      unsigned *ip = alloca(8);
+	      avalue[i] = ip;
+	      ip[0] = *(unsigned *) ptr;
+	      ip[1] = *(unsigned *) stack_args;
+	    }
+	  else
+	    {
+	      avalue[i] = ptr;
+	    }
 	  ptr += 4;
 	  break;
 	}
@@ -223,9 +234,9 @@
 
       /* If we've handled more arguments than fit in registers,
 	 start looking at the those passed on the stack.  */
-      if (ptr == &register_args[6])
+      if (ptr == (char *) &register_args[6])
 	ptr = stack_args;
-      else if (ptr == &register_args[7])
+      else if (ptr == (char *) &register_args[7])
 	ptr = stack_args + 4;
     }