Unexpected consing in COND forms when all clauses return a double float.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
The following function conses when the NUMBER argument is a double float.
(defun test (number)
(cond ((typep number 'double-float)
((typep number 'single-float)
(t
1d0)))
(time
(dotimes (i 1000000)
(test 5d0)))
The function no longer conses when the constant 1d0 in TEST is changed to an integer or the second clause is removed.
The problem occurs in SBCL version 9ae04408 and in sbcl-1.2.4 on hosts running OSX and Linux.
Thank you to stassats in #sbcl for producing a concise test case.
*features*
(:ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :BSD :C-STACK-
:COMMON-LISP :COMPARE-
:DARWIN9-OR-BETTER :FLOAT-EQL-VOPS :GENCGC :IEEE-FLOATING-
:INLINE-CONSTANTS :INODE64 :LINKAGE-TABLE :LITTLE-ENDIAN
:MACH-
:OS-PROVIDES-
:OS-PROVIDES-PUTWC :OS-PROVIDES-
:RAW-INSTANCE-
:SB-EVAL :SB-LDB :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-
:SB-THREAD :SB-UNICODE :SB-XREF-
:STACK-
:STACK-
:STACK-
:UNWIND-
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in sbcl: | |
status: | Triaged → Fix Released |
Changed in sbcl: | |
status: | Fix Released → Triaged |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Fixed in 18f437b Prefer a boxed representation for constants that are immediately returned.