[cffi-devel] Fwd: CFFI should defend itself against fragile handling of narrow return types in SBCL on x86!

Luís Oliveira luismbo at gmail.com
Mon Mar 30 13:05:50 UTC 2009


2009/3/28 Jean-Claude Beaudoin <jean.claude.beaudoin at gmail.com>:
> Recent versions of GCC appear to be leaving spurious bits in the %eax
> register used to return the value of a C function on x86 based platforms
> when the return type is narrower than 32 bits (ie: short or char).

Is that a GCC bug or is that behaviour here to stay?

I'd like to make this work for all the supported Lisps but only when
necessary. Can we check at compile time whether this workaround is
needed? For example, would the following work? Define abs() with a
short/char return value and check whether the upper bits are masked
away.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list