The native compiler handles it fine, both in SBCL and in CMU CL.
+120a:
+ The compiler incorrectly figures the return type of
+ (DEFUN FOO (FRAME UP-FRAME)
+ (IF (OR (NOT FRAME)
+ T)
+ FRAME
+ "BAR"))
+ as NIL.
+
+ This problem exists in CMU CL 18c too. When I reported it on
+ cmucl-imp@cons.org, Raymond Toy replied 23 Aug 2001 with
+ a partial explanation, but no fix has been found yet.
+
+120b:
+ Even in sbcl-0.pre7.x, which is supposed to be free of the old
+ non-ANSI behavior of treating the function return type inferred
+ from the current function definition as a declaration of the
+ return type from any function of that name, the return type of NIL
+ is attached to FOO in 120a above, and used to optimize code which
+ calls FOO.
+
KNOWN BUGS RELATED TO THE IR1 INTERPRETER
(Note: At some point, the pure interpreter (actually a semi-pure
;;; call to SB!EVAL::INTERNAL-APPLY-LOOP, we make an interpreted frame
;;; to replace FRAME. The interpreted frame points to FRAME.
(defun possibly-an-interpreted-frame (frame up-frame)
+
+ ;; trivial without SB-INTERPRETER
+ #!-sb-interpreter (declare (ignore up-frame))
+ #!-sb-interpreter frame
+
+ ;; nontrivial with SB-INTERPRETER
+ #!+sb-interpreter
(if (or (not frame)
- #!+sb-interpreter (not (eq (debug-function-name (frame-debug-function
- frame))
- 'sb!eval::internal-apply-loop))
- #!-sb-interpreter t
+ (not (eq (debug-function-name (frame-debug-function
+ frame))
+ 'sb!eval::internal-apply-loop))
*debugging-interpreter*
(compiled-frame-escaped frame))
frame
(defun float-radix (x)
#!+sb-doc
"Return (as an integer) the radix b of its floating-point argument."
- (declare (type float x))
;; ANSI says this function "should signal an error if [..] argument
;; is not a float". Since X is otherwise ignored, Python doesn't
;; check the type by default, so we have to do it ourself:
;;; EVAL-WHEN magic properly): Delegate to the byte compiler.
#!-sb-interpreter
(defun sb!eval:internal-eval (expr)
- (let ((name (gensym "EVAL-TMPFUN-")))
- (multiple-value-bind (fun warnings-p failure-p)
- (compile name
- `(lambda ()
- (declare (optimize (speed 0) (debug 1))) ; to byte-compile
- (declare (optimize (space 1) (safety 1)))
- (declare (optimize (compilation-speed 3)))
- ,expr))
- (declare (ignore warnings-p))
- (if failure-p
- (error 'simple-program-error
- :format-control
- "~@<failure when precompiling ~2I~_~S ~I~_ for ~S"
- :format-arguments (list expr 'eval))
- (funcall fun)))))
+ (funcall (compile (gensym "EVAL-TMPFUN-")
+ `(lambda ()
+ ;; SPEED=0,DEBUG=1 => byte-compile
+ (declare (optimize (speed 0) (debug 1)))
+ (declare (optimize (space 1) (safety 1)))
+ (declare (optimize (compilation-speed 3)))
+ ,expr))))
;;; Given a function, return three values:
;;; 1] A lambda expression that could be used to define the function,
to a compiled function, returning (VALUES THING WARNINGS-P FAILURE-P),
where if NAME is NIL, THING is the result of compilation, and
otherwise THING is NAME. When NAME is not NIL, the compiled function
- is also set into (FDEFINITION NAME)."
+ is also set into (MACRO-FUNCTION NAME) if NAME names a macro, or into
+ (FDEFINITION NAME) otherwise."
(multiple-value-bind (compiled-definition warnings-p failure-p)
(if (compiled-function-p definition)
(values definition nil nil)
(actually-compile name definition))
(cond (name
- (unless failure-p
- (setf (fdefinition name) compiled-definition))
+ (if (macro-function name)
+ (setf (macro-function name) compiled-definition)
+ (setf (fdefinition name) compiled-definition))
(values name warnings-p failure-p))
(t
(values compiled-definition warnings-p failure-p)))))
;;;
;;; (Peter Van Eynde's ansi-test suite caught this, and Eric Marsden
;;; reported a fix for CMU CL, which was ported to sbcl-0.6.12.35.)
-#+nil ; FIXME: Something in sbcl-0.7.pre15 broke this again.
(assert (typep (nth-value 1 (ignore-errors (float-radix "notfloat")))
- 'type-error))
\ No newline at end of file
+ 'type-error))
;;; four numeric fields, is used for versions which aren't released
;;; but correspond only to CVS tags or snapshots.
-"0.pre7.14.flaky4.9"
+"0.pre7.14.flaky4.10"