close Warning: Can't synchronize with repository "(default)" (/project/cmucl/public_html/git/cmucl.git does not appear to be a Git repository.). Look in the Trac log for more information.

Opened 5 years ago

#64 new defect

Type derivation/compiler bug

Reported by: rtoy Owned by: somebody
Priority: major Milestone:
Component: Core Version: 2012-12
Keywords: Cc:

Description

Compiling the following function causes a compiler bug:

(defun bug (n input output desired gain smooth)
  (declare (type (complex double-float) desired gain)
	   (type double-float smooth)
	   (type (simple-array single-float (*)) input)
	   (type (simple-array (complex single-float) (*)) output)
	   (fixnum n)
	   (optimize (speed 3) (safety 0)))
  (dotimes (k n)
    (declare (fixnum k))
    (setf gain (+ gain (* (- desired gain) smooth)))
    (let ((p (* gain (aref input k))))
      (setf (aref output k) p)))
  (+ 0 gain))

The message is caused by (* gain (aref input k)):

;   (* GAIN (AREF INPUT K))
; ==>
;   (* C::X (COERCE C::Y 'DOUBLE-FLOAT))
; Warning: Result is a (COMPLEX
;                       DOUBLE-FLOAT), not a (VALUES &OPTIONAL (COMPLEX SINGLE-FLOAT) &REST T).
; 
; Note: Forced to do GENERIC-* (cost 30).
;     Unable to do inline complex float arithmetic (cost 4) because:
;     This shouldn't happen!  Bug?
;     Result types invalid.
; 

Change History (0)

Note: See TracTickets for help on using tickets.