[cmucl-ticket] [cmucl] #64: Type derivation/compiler bug

cmucl cmucl-devel at common-lisp.net
Thu Dec 13 02:38:37 UTC 2012


#64: Type derivation/compiler bug
--------------------+-------------------------------------------------------
 Reporter:  rtoy    |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  major   |   Milestone:          
Component:  Core    |     Version:  2012-12 
 Keywords:          |  
--------------------+-------------------------------------------------------
 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.
 ;
 }}}

-- 
Ticket URL: <http://trac.common-lisp.net/cmucl/ticket/64>
cmucl <http://common-lisp.net/project/cmucl>
Cmucl is a high-performance, free Common Lisp implementation.


More information about the cmucl-ticket mailing list