Raymond Toy <[EMAIL PROTECTED]> writes:

> 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.

(in-guessing-mode

  SBCL does not use modular arithmetic here: it stops on CAST. For CMUCL
  type assertions are transparent, so it replaces + with +-MOD32. But
  you need to clear CONTINUATION-ASSERTED-TYPE after that. And to do
  something clever to distinguish safe/unsafe assertions.

)

-- 
Regards,
Alexey Dejneka

"Alas, the spheres of truth are less transparent than those of
illusion." -- L.E.J. Brouwer

Reply via email to