Index: testsuite/libffi.call/closure_fn0.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn0.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 closure_fn0.c
--- testsuite/libffi.call/closure_fn0.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/closure_fn0.c	22 Dec 2008 14:49:52 -0000
@@ -25,7 +25,7 @@
     (int)(*(double *)args[8]) + (int)*(int *)args[9] +
     (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
     (int)*(int *)args[12] + (int)(*(int *)args[13]) +
-    (int)(*(int *)args[14]) +  *(int *)args[15] + (int)(long)userdata;
+    (int)(*(int *)args[14]) +  *(int *)args[15] + (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]),
@@ -37,7 +37,7 @@
 	 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
 	 (int)*(int *)args[12], (int)(*(int *)args[13]),
 	 (int)(*(int *)args[14]),*(int *)args[15],
-	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+	 (int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
 
 }
 
Index: testsuite/libffi.call/closure_fn1.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn1.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 closure_fn1.c
--- testsuite/libffi.call/closure_fn1.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/closure_fn1.c	22 Dec 2008 14:49:52 -0000
@@ -21,7 +21,7 @@
     (int)(*(double*)args[8]) + (int)*(int *)args[9] +
     (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
     (int)*(int *)args[12] + (int)(*(int *)args[13]) +
-    (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
+    (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(float *)args[0], (int)(*(float *)args[1]),
@@ -32,7 +32,7 @@
 	 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
 	 (int)*(int *)args[12], (int)(*(int *)args[13]),
 	 (int)(*(int *)args[14]), *(int *)args[15],
-	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+	 (int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
 }
 
 typedef int (*closure_test_type1)(float, float, float, float, signed short,
Index: testsuite/libffi.call/closure_fn2.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn2.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 closure_fn2.c
--- testsuite/libffi.call/closure_fn2.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/closure_fn2.c	22 Dec 2008 14:49:52 -0000
@@ -20,7 +20,7 @@
     (int)(*(double *)args[8]) + (int)*(int *)args[9] +
     (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
     (int)*(int *)args[12] + (int)(*(float *)args[13]) +
-    (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
+    (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(double *)args[0], (int)(*(double *)args[1]),
@@ -30,7 +30,7 @@
 	 (int)(*(double*)args[8]), (int)*(int *)args[9],
 	 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
 	 (int)*(int *)args[12], (int)(*(float *)args[13]),
-	 (int)(*(int *)args[14]), *(int *)args[15], (int)(long)userdata,
+	 (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata,
 	 (int)*(ffi_arg *)resp);
 }
 
Index: testsuite/libffi.call/closure_fn3.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn3.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 closure_fn3.c
--- testsuite/libffi.call/closure_fn3.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/closure_fn3.c	22 Dec 2008 14:49:52 -0000
@@ -20,7 +20,7 @@
      (int)(*(double *)args[8]) + (int)*(int *)args[9] +
      (int)(*(float *)args[10]) + (int)(*(float *)args[11]) +
      (int)*(int *)args[12] + (int)(*(float *)args[13]) +
-     (int)(*(float *)args[14]) +  *(int *)args[15] + (int)(long)userdata;
+     (int)(*(float *)args[14]) +  *(int *)args[15] + (intptr_t)userdata;
 
    printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	  (int)*(float *)args[0], (int)(*(float *)args[1]),
@@ -30,7 +30,7 @@
 	  (int)(*(double *)args[8]), (int)*(int *)args[9],
 	  (int)(*(float *)args[10]), (int)(*(float *)args[11]),
 	  (int)*(int *)args[12], (int)(*(float *)args[13]),
-	  (int)(*(float *)args[14]), *(int *)args[15], (int)(long)userdata,
+	  (int)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata,
 	  (int)*(ffi_arg *)resp);
 
  }
Index: testsuite/libffi.call/closure_fn4.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn4.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 closure_fn4.c
--- testsuite/libffi.call/closure_fn4.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/closure_fn4.c	22 Dec 2008 14:49:52 -0000
@@ -25,7 +25,7 @@
     (int)*(unsigned long long *)args[12] +
     (int)*(unsigned long long *)args[13] +
     (int)*(unsigned long long *)args[14] +
-    *(int *)args[15] + (int)(long)userdata;
+    *(int *)args[15] + (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(unsigned long long *)args[0],
@@ -44,7 +44,7 @@
 	 (int)*(unsigned long long *)args[13],
 	 (int)*(unsigned long long *)args[14],
 	 *(int *)args[15],
-	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+	 (int)(intptr_T)userdata, (int)*(ffi_arg *)resp);
 
 }
 
Index: testsuite/libffi.call/closure_fn5.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn5.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 closure_fn5.c
--- testsuite/libffi.call/closure_fn5.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/closure_fn5.c	22 Dec 2008 14:49:52 -0000
@@ -24,7 +24,7 @@
     (int)*(unsigned long long *)args[12] +
     (int)*(unsigned long long *)args[13] +
     (int)*(unsigned long long *)args[14] +
-    *(int *)args[15] + (int)(long)userdata;
+    *(int *)args[15] + (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(unsigned long long *)args[0],
@@ -43,7 +43,7 @@
 	 (int)*(unsigned long long *)args[13],
 	 (int)*(unsigned long long *)args[14],
 	 *(int *)args[15],
-	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+	 (int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
 
 }
 
Index: testsuite/libffi.call/closure_fn6.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn6.c,v
retrieving revision 1.2
diff -u -b -w -r1.2 closure_fn6.c
--- testsuite/libffi.call/closure_fn6.c	29 Jan 2008 15:15:20 -0000	1.2
+++ testsuite/libffi.call/closure_fn6.c	22 Dec 2008 14:49:52 -0000
@@ -23,7 +23,7 @@
     (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
     (int)*(int *)args[12] + (int)(*(int *)args[13]) +
     (int)(*(double *)args[14]) +  (int)*(double *)args[15] +
-    (int)(long)userdata;
+    (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(unsigned long long  *)args[0],
@@ -36,7 +36,7 @@
 	 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
 	 (int)*(int *)args[12], (int)(*(int *)args[13]),
 	 (int)(*(double *)args[14]), (int)(*(double *)args[15]),
-	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+	 (intptr_t)userdata, (int)*(ffi_arg *)resp);
 
 }
 
Index: testsuite/libffi.call/closure_loc_fn0.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_loc_fn0.c,v
retrieving revision 1.1
diff -u -b -w -r1.1 closure_loc_fn0.c
--- testsuite/libffi.call/closure_loc_fn0.c	3 Apr 2008 18:57:34 -0000	1.1
+++ testsuite/libffi.call/closure_loc_fn0.c	22 Dec 2008 14:49:52 -0000
@@ -25,7 +25,7 @@
     (int)(*(double *)args[8]) + (int)*(int *)args[9] +
     (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
     (int)*(int *)args[12] + (int)(*(int *)args[13]) +
-    (int)(*(int *)args[14]) +  *(int *)args[15] + (int)(long)userdata;
+    (int)(*(int *)args[14]) +  *(int *)args[15] + (intptr_t)userdata;
 
   printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
 	 (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]),
@@ -37,7 +37,7 @@
 	 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
 	 (int)*(int *)args[12], (int)(*(int *)args[13]),
 	 (int)(*(int *)args[14]),*(int *)args[15],
-	 (int)(long)userdata, (int)*(ffi_arg *)resp);
+	 (int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
 
 }
 
Index: testsuite/libffi.call/cls_align_pointer.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_pointer.c,v
retrieving revision 1.3
diff -u -b -w -r1.3 cls_align_pointer.c
--- testsuite/libffi.call/cls_align_pointer.c	29 Jan 2008 15:15:20 -0000	1.3
+++ testsuite/libffi.call/cls_align_pointer.c	22 Dec 2008 14:49:52 -0000
@@ -19,11 +19,13 @@
   struct cls_struct_align result;
 
   result.a = a1.a + a2.a;
-  result.b = (void *)((unsigned long)a1.b + (unsigned long)a2.b);
+  result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b);
   result.c = a1.c + a2.c;
 
-  printf("%d %lu %d %d %lu %d: %d %lu %d\n", a1.a, (unsigned long)a1.b, a1.c,
-	 a2.a, (unsigned long)a2.b, a2.c, result.a, (unsigned long)result.b,
+  printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", 
+         a1.a, (uintptr_t)a1.b, a1.c,
+	 a2.a, (uintptr_t)a2.b, a2.c,
+         result.a, (uintptr_t)result.b,
 	 result.c);
 
   return result;
@@ -87,14 +89,14 @@
 
   ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
   /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
-  printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c);
+  printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
   CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
 
   res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
-  printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c);
+  printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */
 
   exit(0);
Index: testsuite/libffi.call/cls_longdouble.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_longdouble.c,v
retrieving revision 1.2
diff -u -b -w -r1.2 cls_longdouble.c
--- testsuite/libffi.call/cls_longdouble.c	24 Jul 2008 18:03:48 -0000	1.2
+++ testsuite/libffi.call/cls_longdouble.c	22 Dec 2008 14:49:52 -0000
@@ -4,7 +4,7 @@
    PR:			none.
    Originator:	Blake Chaffin	*/
 
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw x86_64-*-cygwin } } */
 /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
 
 #include "ffitest.h"
Index: testsuite/libffi.call/cls_pointer.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_pointer.c,v
retrieving revision 1.2
diff -u -b -w -r1.2 cls_pointer.c
--- testsuite/libffi.call/cls_pointer.c	24 Jul 2008 18:03:48 -0000	1.2
+++ testsuite/libffi.call/cls_pointer.c	22 Dec 2008 14:49:52 -0000
@@ -9,10 +9,12 @@
 
 void* cls_pointer_fn(void* a1, void* a2)
 {
-	void*	result	= (void*)((long)a1 + (long)a2);
+	void*	result	= (void*)((intptr_t)a1 + (intptr_t)a2);
 
 	printf("0x%08x 0x%08x: 0x%08x\n", 
-	       (unsigned int) a1, (unsigned int) a2, (unsigned int) result);
+	       (unsigned long)(uintptr_t) a1,
+               (unsigned long)(uintptr_t) a2,
+               (unsigned long)(uintptr_t) result);
 
 	return result;
 }
Index: testsuite/libffi.call/cls_pointer_stack.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_pointer_stack.c,v
retrieving revision 1.2
diff -u -b -w -r1.2 cls_pointer_stack.c
--- testsuite/libffi.call/cls_pointer_stack.c	24 Jul 2008 18:03:48 -0000	1.2
+++ testsuite/libffi.call/cls_pointer_stack.c	22 Dec 2008 14:49:52 -0000
@@ -20,22 +20,24 @@
 
 void* cls_pointer_fn2(void* a1, void* a2)
 {
-	long double	trample1	= (long)a1 + (long)a2;
+	long double	trample1	= (intptr_t)a1 + (intptr_t)a2;
 	char		trample2	= ((char*)&a1)[0] + ((char*)&a2)[0];
-	long double	trample3	= (long)trample1 + (long)a1;
+	long double	trample3	= (intptr_t)trample1 + (intptr_T)a1;
 	char		trample4	= trample2 + ((char*)&a1)[1];
-	long double	trample5	= (long)trample3 + (long)a2;
+	long double	trample5	= (intptr_t)trample3 + (intptr_t)a2;
 	char		trample6	= trample4 + ((char*)&a2)[1];
-	long double	trample7	= (long)trample5 + (long)trample1;
+	long double	trample7	= (intptr_t)trample5 + (intptr_t)trample1;
 	char		trample8	= trample6 + trample2;
 
 	dummyVar	= dummy_func(trample1, trample2, trample3, trample4,
 		trample5, trample6, trample7, trample8);
 
-	void*	result	= (void*)((long)a1 + (long)a2);
+	void*	result	= (void*)((intptr_t)a1 + (intptr_t)a2);
 
 	printf("0x%08x 0x%08x: 0x%08x\n", 
-	       (unsigned int) a1, (unsigned int) a2, (unsigned int) result);
+	       (unsigned int)(uintptr_t) a1,
+               (unsigned int)(uintptr_t) a2,
+               (unsigned int)(uintptr_t) result);
 
 	return result;
 }
Index: testsuite/libffi.call/ffitest.h
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/ffitest.h,v
retrieving revision 1.4
diff -u -b -w -r1.4 ffitest.h
--- testsuite/libffi.call/ffitest.h	29 Jan 2008 15:15:20 -0000	1.4
+++ testsuite/libffi.call/ffitest.h	22 Dec 2008 14:49:52 -0000
@@ -2,6 +2,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
+#include <stdint.h>
+#include <inttypes.h>
 #include <ffi.h>
 #include "fficonfig.h"
 
