libffi problem

Bo Thorsen bo@sonofthor.dk
Wed Jul 17 11:13:00 GMT 2002


I have a problem in the port of libffi.

In the testsuite, there is a test that calls a function with a signed char. 
This function simply returns the signed char, and the testsuite checks that 
the returned number is equal to the one given.

The problem here is that the testcase is giving a long long to fill the return 
value in. I wanted to do a memcpy(&rvalue, &value, size), but size here is 1, 
so when giving a negative number to return, this writes the - flag in the 
wrong position (actually returns 129 instead of -127).

What is wrong here? Does libffi always assume that there is a word of 
pointersize to write numbers into? Or is the testsuite wrong?

(For the test here, see in libffi/src/ffitest.c, the test calling return_sc.)

Bo.

-- 

     Bo Thorsen                 |   Praestevejen 4
     Free software developer    |   5290 Marslev
     SuSE Labs                  |   Denmark




More information about the Gcc mailing list