[cmucl-help] Inlined TYPEP over-optimization bug with CHANGE-CLASS

Raymond Toy toy.raymond at gmail.com
Sun Feb 12 05:29:10 UTC 2012


On 2/5/12 6:57 AM, Dan Corkill wrote:
>>> I fully agree (and apologies for the confusion caused by my quick-and-dirty 
>>> example).
>>>
>>> The issue doesn't require being within an instance method--as the following
>>> vanilla-function example shows.
>>>
>>> (in-package :cl-user)
>>>
>>> (defclass foo () ())
>>> (defclass bar () ())
>>>
>>> (defun show-bug (instance)
>>>   (change-class instance 'bar)
>>>   (format t "~&;; Inlined TYPEP: ~s (incorrect)~%;; Not-inlined TYPEP: ~s (correct)~%"
>>>           (typep instance 'foo)
>>>           (locally (declare (notinline typep))
>>>             (typep instance 'foo))))
>>>
>>> (show-bug (make-instance 'foo))
>>>
I placed your code in a file and compiled and loaded it with the 2012-02
snapshot.  I get

CL-USER> (show-bug (make-instance 'foo))
;; Inlined TYPEP: NIL (incorrect)
;; Not-inlined TYPEP: NIL (correct)

What version exactly are you using and how did you run your example to
get an incorrect result?

Ray



More information about the cmucl-help mailing list