Steel Bank Common Lisp

conditional :INITIAL-CONTENTS in MAKE-ARRAY fails to compile

Reported by JTK on 2010-02-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
High
Unassigned

Bug Description

[SBCL 1.0.34 on OS X 10.5 PPC]

The following function works in clisp and openmcl, but not sbcl:

(defun foo (&key toff)
           (make-array 3 :element-type 'double-float
                        :initial-contents
                        (if toff (list toff 0d0 0d0) (list 0d0 0d0 0d0))))

gives the compilation error below.

However, foo2 compiles OK:

(defun foo2 (&key toff)
           (make-array 3 :element-type 'double-float
                        :initial-contents
                         (list (or toff 0d0) 0d0 0d0)))

================================
error when compiling foo:

The value
  (#<sb-c::combination :fun # :args # {13A61A99}>
   #<sb-c::combination :fun # :args # {13A61609}>)
is not of type
  (and atom (not null)).
   [Condition of type type-error]

Backtrace:
  0: (sb-c::lvar-matches #<sb-c::lvar 1 {13A612B1}>)[:external]
  1: (sb-c::transform-make-array-vector #<sb-c::lvar 2 {13A60F79}> #<sb-c::lvar 3 {13A61129}> nil #<sb-c::lvar 1 {13A612B1}> #<sb
-c::combination :fun # :args (# # # # #) {13A60F19}>)
  2: ((lambda (sb-c:call)) #<sb-c::combination :fun # :args (# # # # #) {13A60F19}>)
  3: (sb-c::ir1-transform #<sb-c::combination :fun # :args (# # # # #) {13A60F19}> #<sb-c::transform :type #<sb-kernel:fun-type #
> :note "optimize" :important nil>)
  4: (sb-c::ir1-optimize-combination #<sb-c::combination :fun # :args (# # # # #) {13A60F19}>)
  5: (sb-c::ir1-optimize-block #<sb-c::cblock 35 :START c4 {13A61491}>)
  6: (sb-c::ir1-optimize #<sb-c:component :name "lambda nil" :reanalyze t {13A719D1}> nil)
  7: (sb-c::ir1-optimize-until-done #<sb-c:component :name "lambda nil" :reanalyze t {13A719D1}>)
  8: (sb-c::ir1-phases #<sb-c:component :name "lambda nil" :reanalyze t {13A719D1}>)
  9: (sb-c::compile-component #<sb-c:component :name "lambda nil" :reanalyze t {13A719D1}>)
 10: (sb-c::%compile ..)[:external]

Nathan Froyd (froydnj) wrote :

Confirmed on CVS-ish SBCL on x86-64.

Changed in sbcl:
status: New → Confirmed
importance: Undecided → Medium
importance: Medium → High
Nikodemus Siivola (nikodemus) wrote :

Attached patch fixes this. Committing once freeze is over.

Changed in sbcl:
status: Confirmed → In Progress

  status fixcommitted

In SBCL 1.0.36.2.

Changed in sbcl:
status: In Progress → Fix Committed
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