From: Ulrich Weigand Date: Sun, 11 Jul 2004 11:45:39 +0000 (+0000) Subject: ffi.c (ffi_prep_args): Fix C aliasing violation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5dce82f98a9602dfb781c3cf64ee2c3d0cc05d1;p=gcc.git ffi.c (ffi_prep_args): Fix C aliasing violation. * src/s390/ffi.c (ffi_prep_args): Fix C aliasing violation. (ffi_check_float_struct): Remove unused prototype. From-SVN: r84505 --- diff --git a/libffi/ChangeLog b/libffi/ChangeLog index b76047f7e4e..30d95482cd9 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,8 @@ +2004-07-11 Ulrich Weigand + + * src/s390/ffi.c (ffi_prep_args): Fix C aliasing violation. + (ffi_check_float_struct): Remove unused prototype. + 2004-06-30 Geoffrey Keating * src/powerpc/ffi_darwin.c (flush_icache): ';' is a comment diff --git a/libffi/src/s390/ffi.c b/libffi/src/s390/ffi.c index d672b3c0ef3..399fa2a91d9 100644 --- a/libffi/src/s390/ffi.c +++ b/libffi/src/s390/ffi.c @@ -69,7 +69,6 @@ /*====================================================================*/ static void ffi_prep_args (unsigned char *, extended_cif *); -static int ffi_check_float_struct (ffi_type *); void #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) __attribute__ ((visibility ("hidden"))) @@ -222,15 +221,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif) } } - /* Pointers are passed like UINTs of the same size. */ - if (type == FFI_TYPE_POINTER) -#ifdef __s390x__ - type = FFI_TYPE_UINT64; -#else - type = FFI_TYPE_UINT32; -#endif - - /* Now handle all primitive int/float data types. */ + /* Now handle all primitive int/pointer/float data types. */ switch (type) { case FFI_TYPE_DOUBLE: @@ -251,6 +242,13 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif) else p_ov[n_ov++] = *(unsigned int *) arg; break; + + case FFI_TYPE_POINTER: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = (unsigned long)*(unsigned char **) arg; + else + p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg; + break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: