Compiler's type inference bug with (< safety 3) ?
Hi
Trying to check out ray tracing example from c.c.l in LispWorks 4.4.6 Personal Edition for Windows, I found that compiler with declarations where safety < 3 counts that any summation result has fixnum type. Example:
(defun test (n)
(declare (fixnum n))
(let ((some-var (+ (/ (float n 1.0) 2.0) 1.0)))
(declare (double-float some-var))
some-var))
When you try to compile it with (declaim (optimize (safety 0))) you'll get
;;;*** Warning in TEST: Variable SOME-VAR is declared type FLOAT, but is bound to a value of type FIXNUM
Trying to check out ray tracing example from c.c.l in LispWorks 4.4.6 Personal Edition for Windows, I found that compiler with declarations where safety < 3 counts that any summation result has fixnum type. Example:
(defun test (n)
(declare (fixnum n))
(let ((some-var (+ (/ (float n 1.0) 2.0) 1.0)))
(declare (double-float some-var))
some-var))
When you try to compile it with (declaim (optimize (safety 0))) you'll get
;;;*** Warning in TEST: Variable SOME-VAR is declared type FLOAT, but is bound to a value of type FIXNUM
Same without (+ expr 1.0) compiles without
warnings.
Is it bug ?
Regards
Lisper
Is it bug ?
Regards
Lisper