A few days ago I reported to Franz a problem with the following code:
(defun make-fn (arguments)
#'(lambda ()
(labels ((doit (a b c)
(try-something-else a b c) )
(try-something-else (a b c)
(list 666 a b c) ))
#'(lambda ()
(apply #'doit arguments) )
)))
(defvar *function* nil)
(setf it (funcall (make-fn '(1 2 3))))
(funcall it)
(compile 'make-fn)
(setf it (funcall (make-fn '(1 2 3))))
(funcall it)
The second FUNCALL, after compiling MAKE-FN, results in a error reporting an invalid object type or some other incongruous message. Franz acknowledged the bug as a compiler optimization bug and suggested replacing APPLY with a call to our function of this type:
(defun my-apply (function arguments) (apply function arguments) )
This fixed it. Franz promised that the bug will be fixed in "some future version of ACL".