Declaration for symbol-macro is ignored
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When file-compiling the following form, I get the same optimization note as when I leave out the declaration, as if the declaration were ignored:
(defmethod test-1 (obj)
(declare (optimize speed))
(
(declare (fixnum x))
(incf x 1)))
The note is:
; in: DEFMETHOD TEST-1 (T)
; (INCF X 1)
;
; note: unable to
; associate +/(+ -) of constants
; due to type uncertainty:
; The first argument is a NUMBER, not a RATIONAL.
;
; note: forced to do GENERIC-+ (cost 10)
; unable to do inline fixnum arithmetic (cost 1) because:
; The first argument is a T, not a FIXNUM.
; The result is a (VALUES NUMBER &OPTIONAL), not a (VALUES FIXNUM &OPTIONAL).
; unable to do inline fixnum arithmetic (cost 2) because:
; The first argument is a T, not a FIXNUM.
; The result is a (VALUES NUMBER &OPTIONAL), not a (VALUES FIXNUM &OPTIONAL).
; etc.
This doesn't happen if I macroexpand the INCF by hand, or if I use DEFUN instead of DEFMETHOD, or if I use a function other than SLOT-VALUE. In other words, none of the following definitions cause that spurious optimization note:
(defmethod test-2 (obj)
(declare (optimize speed))
(
(declare (fixnum x))
(setf x (+ 1 x))))
(defun test-3 (obj)
(declare (optimize speed))
(
(declare (fixnum x))
(incf x 1)))
(defmethod test-4 (obj)
(declare (optimize speed))
(
(declare (fixnum x))
(incf x 1)))
Version: SBCL 2.4.2.92-f78315fe1
Changed in sbcl: | |
status: | New → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |