diff mbox

Backport https://github.com/atgreen/libffi/commit/0de3277b18cf54be3b81d509b9be9b47d9bc1e82 to gcc libffi (PR middle-end/56000)

Message ID 20130117115956.GO7269@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 17, 2013, 11:59 a.m. UTC
Hi!

Is it ok to backport
https://github.com/atgreen/libffi/commit/0de3277b18cf54be3b81d509b9be9b47d9bc1e82
fix from upstream to gcc's libffi copy?  The tests fail on various targets.

2013-01-07  Thorsten Glaser <tg@mirbsd.org>

	* testsuite/libffi.call/cls_uchar_va.c,
	testsuite/libffi.call/cls_ushort_va.c,
	testsuite/libffi.call/va_1.c: Testsuite fixes.


	Jakub

Comments

Richard Biener Jan. 17, 2013, 12:18 p.m. UTC | #1
On Thu, Jan 17, 2013 at 12:59 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> Is it ok to backport
> https://github.com/atgreen/libffi/commit/0de3277b18cf54be3b81d509b9be9b47d9bc1e82
> fix from upstream to gcc's libffi copy?  The tests fail on various targets.

Ok.

Thanks,
Richard.

> 2013-01-07  Thorsten Glaser <tg@mirbsd.org>
>
>         * testsuite/libffi.call/cls_uchar_va.c,
>         testsuite/libffi.call/cls_ushort_va.c,
>         testsuite/libffi.call/va_1.c: Testsuite fixes.
>
> --- libffi/testsuite/libffi.call/cls_uchar_va.c
> +++ libffi/testsuite/libffi.call/cls_uchar_va.c
> @@ -12,9 +12,9 @@ typedef unsigned char T;
>  static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
>                          void* userdata __UNUSED__)
>   {
> -   *(T *)resp = *(T *)args[0];
> +   *(ffi_arg *)resp = *(T *)args[0];
>
> -   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
> +   printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
>   }
>
>  typedef T (*cls_ret_T)(T, ...);
> --- libffi/testsuite/libffi.call/cls_ushort_va.c
> +++ libffi/testsuite/libffi.call/cls_ushort_va.c
> @@ -12,9 +12,9 @@ typedef unsigned short T;
>  static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
>                          void* userdata __UNUSED__)
>   {
> -   *(T *)resp = *(T *)args[0];
> +   *(ffi_arg *)resp = *(T *)args[0];
>
> -   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
> +   printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
>   }
>
>  typedef T (*cls_ret_T)(T, ...);
> --- libffi/testsuite/libffi.call/va_1.c
> +++ libffi/testsuite/libffi.call/va_1.c
> @@ -5,7 +5,7 @@
>     Originator:         ARM Ltd. */
>
>  /* { dg-do run } */
> -/* { dg-output "" { xfail avr32*-*-* x86_64-*-*-* } } */
> +/* { dg-output "" { xfail avr32*-*-* } } */
>
>  #include "ffitest.h"
>  #include <stdarg.h>
> @@ -132,10 +132,10 @@ main (void)
>    arg_types[1] = &s_type;
>    arg_types[2] = &l_type;
>    arg_types[3] = &s_type;
> -  arg_types[4] = &ffi_type_uint;
> -  arg_types[5] = &ffi_type_sint;
> -  arg_types[6] = &ffi_type_uint;
> -  arg_types[7] = &ffi_type_sint;
> +  arg_types[4] = &ffi_type_uchar;
> +  arg_types[5] = &ffi_type_schar;
> +  arg_types[6] = &ffi_type_ushort;
> +  arg_types[7] = &ffi_type_sshort;
>    arg_types[8] = &ffi_type_uint;
>    arg_types[9] = &ffi_type_sint;
>    arg_types[10] = &ffi_type_ulong;
>
>         Jakub
diff mbox

Patch

--- libffi/testsuite/libffi.call/cls_uchar_va.c
+++ libffi/testsuite/libffi.call/cls_uchar_va.c
@@ -12,9 +12,9 @@  typedef unsigned char T;
 static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 			 void* userdata __UNUSED__)
  {
-   *(T *)resp = *(T *)args[0];
+   *(ffi_arg *)resp = *(T *)args[0];
 
-   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+   printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
  }
 
 typedef T (*cls_ret_T)(T, ...);
--- libffi/testsuite/libffi.call/cls_ushort_va.c
+++ libffi/testsuite/libffi.call/cls_ushort_va.c
@@ -12,9 +12,9 @@  typedef unsigned short T;
 static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 			 void* userdata __UNUSED__)
  {
-   *(T *)resp = *(T *)args[0];
+   *(ffi_arg *)resp = *(T *)args[0];
 
-   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+   printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
  }
 
 typedef T (*cls_ret_T)(T, ...);
--- libffi/testsuite/libffi.call/va_1.c
+++ libffi/testsuite/libffi.call/va_1.c
@@ -5,7 +5,7 @@ 
    Originator:	        ARM Ltd. */
 
 /* { dg-do run } */
-/* { dg-output "" { xfail avr32*-*-* x86_64-*-*-* } } */
+/* { dg-output "" { xfail avr32*-*-* } } */
 
 #include "ffitest.h"
 #include <stdarg.h>
@@ -132,10 +132,10 @@  main (void)
   arg_types[1] = &s_type;
   arg_types[2] = &l_type;
   arg_types[3] = &s_type;
-  arg_types[4] = &ffi_type_uint;
-  arg_types[5] = &ffi_type_sint;
-  arg_types[6] = &ffi_type_uint;
-  arg_types[7] = &ffi_type_sint;
+  arg_types[4] = &ffi_type_uchar;
+  arg_types[5] = &ffi_type_schar;
+  arg_types[6] = &ffi_type_ushort;
+  arg_types[7] = &ffi_type_sshort;
   arg_types[8] = &ffi_type_uint;
   arg_types[9] = &ffi_type_sint;
   arg_types[10] = &ffi_type_ulong;