This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

re: long longlong in libffi (powerpc)


=?iso-8859-1?Q?Andreas=5FTobler?= writes:
 > To follow up. (Sorry can't quote, webmail)
 > 
 > The problem I have is also visible on powerpc-linux.
 > 
 > Given this testcase:
 > 
 > static void closure_test_fn4(ffi_cif* cif,void* resp,void** args,
 >                              void* userdata)
 >  {
 >     *(ffi_arg*)resp =
 >       (int)*(long *)args[0] +(*(int *)args[1]) +
 >       /* (int)(*(float *)args[2]) + *(int *)args[3]*/ + (int)(long)userdata;
 > 
 >     printf("%d %d %d %d: %d\n",
 >            (int)*(long *)args[0], (*(int *)args[1]),
 >            /*  (int)(*(float *)args[2]), *(int *)args[3],*/ (int)(long)userdata,
 >            *(int*)resp);
 >  }
 > 
 > typedef int (*closure_test_type4)(long, int);
 > 
 > I run it with this definition:
 > 
 >       cl_arg_types[0] = &ffi_type_ulong;
 >       cl_arg_types[1] = &ffi_type_uint;
 >       cl_arg_types[2] = NULL;
 > 
 > Here I get a failure since ulong is 'mapped' onto longlong (8bytes)
 > 
 > setting the arg[0] type to &ffi_type_uint32 makes the testcase pass.
 > 
 > So I'm a bit confused. My long is 4 byte, my longlong 8. And the ABI from
 > sysv & darwin handles the long and the longlong different. (long !=longlong)
 > 
 > 
 > Do I follow a phantom or my one explain to me what I forget?

SIZEOF_LONG is determined by an autoconf test.  Here it is:

--------------------------------------------------------------------------------------
echo $ac_n "checking size of long""... $ac_c" 1>&6
echo "configure:3135: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  for ac_size in 4 8 1 2 16 12  ; do # List sizes in rough order of prevalence.
  cat > conftest.$ac_ext <<EOF
#line 3141 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>


int main() {
switch (0) case 0: case (sizeof (long) == $ac_size):;
; return 0; }
EOF
if { (eval echo configure:3151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  ac_cv_sizeof_long=$ac_size
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
  if test x$ac_cv_sizeof_long != x ; then break; fi
done

fi
--------------------------------------------------------------------------------------

Please try to figure out if this is returning the wrong answer, and if
so why.  It could be s shell bug.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]