Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#1237 closed defect (fixed)

Invalid Memory Operation with (complex double-float) arrays

Reported by: svspire Owned by: gb
Priority: critical Milestone:
Component: Compiler Version: trunk
Keywords: Cc:

Description

; Welcome to Clozure Common Lisp Version 1.10-dev-r16221M-trunk  (DarwinX8664)!

(defparameter cdf1 (make-array 100
                             :element-type '(complex double-float)
                             :adjustable nil
                             :fill-pointer nil
                             :initial-element #c(0.0d0 0.0d0)))

(defparameter cdf2 (make-array 100
                             :element-type '(complex double-float)
                             :adjustable nil
                             :fill-pointer nil
                             :initial-element #c(0.0d0 0.0d0)))

(defun init-vector (a)
    (loop :for i :below (length a)
      :do 
        (let ((initval (coerce (random 100.0) (array-element-type a))))
          (setf (aref a i) initval))))

(init-vector cdf1)
(init-vector cdf2)

(defun vdp-cdf (a b)
  "Vector dot product. Complex double-float."
  (declare (optimize (speed 3) (safety 2) (debug 0))
           (type (SIMPLE-ARRAY (complex DOUBLE-FLOAT)) a b))
  (let ((size (min (length a) (length b)))
        (accum #c(0.0d0 0.0d0)))
    (declare (fixnum size)
             (type (complex DOUBLE-FLOAT) accum))
    (loop :for i :of-type fixnum :below size
      :do (incf accum (* (aref a i)
                         (aref b i))))
    accum))

(vdp-cdf cdf1 cdf2)

#|
If safety < 3:

> Error: Invalid memory operation.
> While executing: VDP-CDF, in process Listener(4).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.
1 > 

If safety = 3:
[produces answer]
|#

Change History (3)

comment:1 Changed 5 years ago by gb

  • Status changed from new to assigned

comment:2 Changed 5 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [16227]) Several typos/cut-and-paste errors related to AREF on (COMPLEX *FLOAT) arrays.

Fixes ticket:1237 in the trunk.

comment:3 Changed 5 years ago by rme

(In [16235]) Merge from trunk. (See ticket:1237)

Note: See TracTickets for help on using tickets.