Subject: Re: [PARTIALLY SOLVED] bug#13342: Errors trying to build Guile 2.0.7

From: Peter Teeson <[email-masked]>
Date: Tue, 08 Jan 2013 11:08:43 -0500

Hi Ludo:
I think the reason that we get this error is that the "a" argument is declared to be only 8 bits wide
but is passed in as -1 which is correctly represented as 0xFFFFFFFF

However an 8-bit representation is 0xFF which is only 255.

Here is how I tracked it down:
(0) Took the printf's from my test program and placed them in 

scm_t_int64 test_ffi_sum (scm_t_int8 a, scm_t_int16 b,
                          scm_t_int32 c, scm_t_int64 d);
scm_t_int64 test_ffi_sum (scm_t_int8 a, scm_t_int16 b,
                          scm_t_int32 c, scm_t_int64 d)
{
    scm_t_int64 sum;
    printf("scm_t_int64 d %" "ll" "d" " %#llX \n", d,d);
    printf("scm_t_int32 c %" "d" " %#X \n", c,c);
    printf("scm_t_int16 b %" "hd" " %#X \n", b,b);
    printf("scm_t_int8 a %" "hh" "d" " %#X \n", a,a);
    sum = d + c + b + a;
    printf("scm_t_int64 sum %" "ll" "d" " %#llX \n", sum,sum);

    a = -1; //  NOTE:re-assign of a!!!!
    printf("scm_t_int16 a %" "hd" " %#X \n", a,a);

    return d + c + b + a;
}

(1) Did make and make check with the following result

scm_t_int64 d 40000000000 0X9502F9000 
scm_t_int32 c -30000 0XFFFF8AD0 
scm_t_int16 b 2000 0X7D0 
scm_t_int8 a -1 0XFF 
scm_t_int64 sum 39999972255 0X9502F239F 
scm_t_int16 a -1 0XFFFFFFFF 
PASS: test-ffi

(2) Observe that the test passed. 
So I think my original suspicion seems to have been confirmed.

I do not know where to go from here but await your further instructions.

respect

Peter