Mark Saaltink wrote:
> Dear cmucl developers,
> 
> There seems to be an error in the compilation of fixnum operations:
> 
> (defun hash2 (x y)
>   (declare (type fixnum x y))
>   (logand (the fixnum (+ x y)) 255))
> 
> If I compile this in 19a or the 2004-11 snapshot (in linux on an x86),
> any calls where the sum is negative give an error.  For example:
> 
> * (hash2 -1 0)
> 
> Type-error in KERNEL::OBJECT-NOT-FIXNUM-ERROR-HANDLER:
>    4294967295 is not of type FIXNUM
>    [Condition of type TYPE-ERROR]
> 
> As far as I can tell, the optimization settings do not affect the outcome.
> 
> The disassembly of hash2 indicates that X86::+-MOD32 is called, so maybe
> this has to do with the recent introduction of modular arithmetic.

Oops.  Yes, it seems to be a bug.  You can work around this particular 
problem by changing (the fixnum (+ x y)) to just (+ x y).

I'll see what I can do.

Ray


Reply via email to