[Openmcl-devel] Error when setting a value in a matrix unless safety 3

Gary Byers gb at clozure.com
Wed May 13 11:02:26 PDT 2009



On Wed, 13 May 2009, Stas Boukarev wrote:

> Keith James <kdj at sanger.ac.uk> writes:
>
>> Hi,
>>
>> I'm porting some of my libraries that were developed on SBCL and
>> LispWorks. I'm experiencing an error that I can't explain when setting
>> a value (a single-float) into a type-declared matrix of single
>> floats. I've discovered that I can avoid the error by setting safety 3.
>>
>> The error message is
>>
>> value -5.0 is not of the expected type (SIMPLE-ARRAY DOUBLE-FLOAT (* *))
>>
>> As the algorithm is very compute intensive (Smith-Waterman alignment),
>> I would like to optimize for speed and slightly reduced safety. I have
>> extracted the smallest self-contained example that I can, illustrating
>> the problem.
>>
>> Most of the code has been macroexpanded, hence the odd variable
>> names. I've commented the exact point of the error. Any suggestions
>> would be much appreciated.
>>
>> I'm using Version 1.3-r11936 (LinuxX8664).
>
> I was able to reduce to the following:
>
> (defun test ()
>  (let ((array (make-array '(1 1) :initial-element 2.0
>                           :element-type 'single-float))
>        (var 1.0))
>    (setf (aref array 0 0) var
>          var nil)))
>
> And it doesn't trigger on LinuxX8632.
>

The bug has to do with the compiler trying to keep two different
things in the same register at the same time.  (No matter how often it
tries that, it never works ...)

The x8632 cleverly minimizes the possibility of bugs like this by ...
well, by being seriously register-starved.

I think that it's fixed in the trunk now; once I'm pretty confident
that it's indeed fixed (and that the fix didn't break anything), I'll
move it to the 1.3 svn tree.


> -- 
> With best regards, Stas.
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list