Open coding coercion to (complex double-float) not implemented.

Bug #1309815 reported by Mark Cox on 2014-04-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Wishlist
Unassigned

Bug Description

The compiler complains that it is unable to open code the coercion from a double-float to a complex double-float in the following

  (defun copy-to/slow (output input)
   (declare (type (simple-array (complex double-float) (*)) output)
            (type (simple-array double-float (*)) input)
            (optimize (speed 3) (safety 1) (debug 1)))
   (dotimes (i (length output))
     (setf (aref output i) (coerce (aref input i)
                                    '(complex double-float))))
    output)

As a result, the function COPY-TO/SLOW conses substantially.

If the coercion is replaced with (COMPLEX (AREF INPUT I)), it does not complain

  (defun copy-to/fast (output input)
    (declare (type (simple-array (complex double-float) (*)) output)
             (type (simple-array double-float (*)) input)
             (optimize (speed 3) (safety 1) (debug 1)))
    (dotimes (i (length output))
      (setf (aref output i) (complex (aref input i))))
    output)

This function performs no consing as expected.

Mark Cox (markcox80) on 2014-04-19
description: updated
description: updated
description: updated
Stas Boukarev (stassats) on 2014-04-19
Changed in sbcl:
assignee: nobody → Stas Boukarev (stassats)
importance: Undecided → Wishlist
Stas Boukarev (stassats) wrote :

In aab5bd0d43016a52b5cf0df34885f0d97b03a804, both produce the same code.

Changed in sbcl:
status: New → Fix Committed
assignee: Stas Boukarev (stassats) → nobody
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers