CHECK-TYPE doesn't allow optimization in all cases?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Confirmed
|
Low
|
Unassigned |
Bug Description
try to compile this definition with all the combination of the commented out 'check-type and 'declare type (none, both, etc).
all the compilations will result in a different number of optimization notes, which suggests that the two different ways of communicating the type information to the compiler does not result in the same type annotation.
strictly speaking this is not a bug, but i prefer using 'check-type to 'declare for the guaranteed error it signals, and i'd also like to have the same optimizations applied in that case.
i've tried to reduce the test case, but the difference goes away even with small changes...
this is with 1.0.32.37 on x86_64.
(in-package :cl-user)
(defun write-ratio-
(declare (optimize speed))
;(declare (type fixnum digit-length-
;(check-type digit-length-limit fixnum)
(flet ((fail ()
(unless *silently-
(setf *silently-
(multiple-
(truncate (if (< number 0)
(let* ((quotient-part (princ-to-string quotient))
(when (<= remaining-
(fail))
(unless (zerop remainder)
(loop :for decimal-digits :upfrom 1 :until (zerop remainder)
:do (when (> decimal-digits remaining-
:do (multiple-
I don't get any notes at all with 1.0.33.2 on x86-32. Perhaps you can add the actual notes
for both cases.