This is the mail archive of the
libffi-discuss@sources.redhat.com
mailing list for the libffi project.
libffi bug?
- From: Thomas Heller <theller at python dot net>
- To: libffi-discuss at sources dot redhat dot com, gcc at gcc dot gnu dot org
- Date: Fri, 18 Jun 2004 19:58:43 +0200
- Subject: 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