GHC FFI Return Type Bug

Ashley Yakeley ashley@semantic.org
Tue, 7 Aug 2001 15:59:33 -0700


At 2001-08-07 11:13, Carl R. Witty wrote:

>You can see that the code for f is:
>	call g
>	andl $255,%eax
>	ret
>So gcc believes that a function which returns a value of type unsigned
>char is not responsible for clearing the high 3 bytes of %eax.

This is to be expected; in most cases the caller will not be doing any 
kind of extension and so the high three bytes won't need to be masked at 
all. Only the caller knows whether extension is necessary, and (as 
Sigbjorn points out) whether it needs to do signed or unsigned extension.

-- 
Ashley Yakeley, Seattle WA