This is the mail archive of the libffi-discuss@sources.redhat.com mailing list for the libffi 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]

libffi bug?


I'm looking at this small program from libffi's testsuite, return_sc.c:

==========================================================
#include "ffitest.h"

static signed char return_sc(signed char sc)
{
  return sc;
}
int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  ffi_arg rint;
  signed char sc;
  unsigned long ul;

  args[0] = &ffi_type_schar;
  values[0] = ≻

  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
                     &ffi_type_schar, args) == FFI_OK);

  for (sc = (signed char) -127;
       sc < (signed char) 127; sc++)
    {
      ul++;
      ffi_call(&cif, FFI_FN(return_sc), &rint, values);
      CHECK(rint == (ffi_arg) sc);
    }
  exit(0);
}
==========================================================

This runs fine on a sparc solaris 9 system, but crashes with a bus error
when I replace the
  ffi_arg rint;
line with this one
  signed char rint;

Hm, I thought libffi would handle this - is it a bug?

Thanks,

Thomas


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