Message ID | yddhbce4v4g.fsf@manam.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
On 08.02.11 12:35, Rainer Orth wrote: > Two libffi testcases currently fail on IRIX 6.5 for the N32 ABI: > > FAIL: libffi.call/cls_pointer.c -O0 -W -Wall (test for excess errors) > Excess errors: > /vol/gcc/src/hg/trunk/irix/libffi/testsuite/libffi.call/cls_pointer.c: In function 'main': > /vol/gcc/src/hg/trunk/irix/libffi/testsuite/libffi.call/cls_pointer.c:68:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] > > The line in question is > > res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); > > and ffi_arg is defined as > > /* N32 and N64 frames have 64bit integer args */ > typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); > typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); > > in src/mips/ffitarget.h. > > Although I have no idea why gcc would warn about casting a pointer to a > *wider* integer type, the warning can be avoided by casting to uintptr_t > first. > > The following patch does this, tested with the appropriate runtest > invocations for both ABIs on mips-sgi-irix6.5, i386-pc-solaris2.11 and > sparc-sun-solaris2.11. > > Ok for mainline and the 4.5 branch after testing there? Ok from AG and me. Danke & Gruss, Andreas
diff -r 8fab3983de1b libffi/testsuite/libffi.call/cls_pointer.c --- a/libffi/testsuite/libffi.call/cls_pointer.c Fri Feb 04 19:23:36 2011 +0100 +++ b/libffi/testsuite/libffi.call/cls_pointer.c Tue Feb 08 12:24:00 2011 +0100 @@ -65,7 +65,7 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ diff -r 8fab3983de1b libffi/testsuite/libffi.call/cls_pointer_stack.c --- a/libffi/testsuite/libffi.call/cls_pointer_stack.c Fri Feb 04 19:23:36 2011 +0100 +++ b/libffi/testsuite/libffi.call/cls_pointer_stack.c Tue Feb 08 12:24:00 2011 +0100 @@ -129,7 +129,7 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" }