3 Bugs can be reported on the help mailing list
4 sbcl-help@lists.sourceforge.net
5 or on the development mailing list
6 sbcl-devel@lists.sourceforge.net
8 Please include enough information in a bug report that someone reading
9 it can reproduce the problem, i.e. don't write
10 Subject: apparent bug in PRINT-OBJECT (or *PRINT-LENGTH*?)
11 PRINT-OBJECT doesn't seem to work with *PRINT-LENGTH*. Is this a bug?
13 Subject: apparent bug in PRINT-OBJECT (or *PRINT-LENGTH*?)
14 In sbcl-1.2.3 running under OpenBSD 4.5 on my Alpha box, when
15 I compile and load the file
16 (DEFSTRUCT (FOO (:PRINT-OBJECT (LAMBDA (X Y)
17 (LET ((*PRINT-LENGTH* 4))
20 then at the command line type
22 the program loops endlessly instead of printing the object.
24 If you run into a signal related bug, you are getting fatal errors
25 such as 'signal N is [un]blocked' or just hangs, and you want to send
26 a useful bug report then:
28 - compile sbcl with ldb support (feature :sb-ldb, see
29 base-target-features.lisp-expr) and change '#define QSHOW_SIGNAL 0'
30 to '#define QSHOW_SIGNAL 1' in src/runtime/runtime.h.
32 - isolate a smallish test case, run it
34 - if it just hangs kill it with sigabrt: kill -ABRT <pidof sbcl>
36 - print the backtrace from ldb by typing 'ba'
38 - attach gdb: gdb -p <pidof sbcl> and get backtraces for all threads:
41 - if multiple threads are in play then still in gdb, try to get Lisp
42 backtrace for all threads: 'thread apply all
43 call_backtrace_from_fp($ebp, 100)'. Substitute $ebp with $rbp on
46 - send a report with the backtraces and the output (both stdout,
47 stderr) produced by sbcl
49 - don't forget to include OS and SBCL version
51 - if available include info on outcome of the same test with other
52 versions of SBCL, OS, ...
57 There is also some information on bugs in the manual page and
58 in the TODO file. Eventually more such information may move here.
60 The gaps in the number sequence belong to old bug descriptions which
61 have gone away (typically because they were fixed, but sometimes for
62 other reasons, e.g. because they were moved elsewhere).
66 DEFSTRUCT almost certainly should overwrite the old LAYOUT information
67 instead of just punting when a contradictory structure definition
68 is loaded. As it is, if you redefine DEFSTRUCTs in a way which
69 changes their layout, you probably have to rebuild your entire
70 program, even if you know or guess enough about the internals of
71 SBCL to wager that this (undefined in ANSI) operation would be safe.
73 3: "type checking of structure slots"
75 ANSI specifies that a type mismatch in a structure slot
76 initialization value should not cause a warning.
78 This one might not be fixed for a while because while we're big
79 believers in ANSI compatibility and all, (1) there's no obvious
80 simple way to do it (short of disabling all warnings for type
81 mismatches everywhere), and (2) there's a good portable
82 workaround, and (3) by their own reasoning, it looks as though
83 ANSI may have gotten it wrong. ANSI justifies this specification
85 The restriction against issuing a warning for type mismatches
86 between a slot-initform and the corresponding slot's :TYPE
87 option is necessary because a slot-initform must be specified
88 in order to specify slot options; in some cases, no suitable
90 However, in SBCL (as in CMU CL or, for that matter, any compiler
91 which really understands Common Lisp types) a suitable default
92 does exist, in all cases, because the compiler understands the
93 concept of functions which never return (i.e. has return type NIL).
94 Thus, as a portable workaround, you can use a call to some
95 known-never-to-return function as the default. E.g.
97 (BAR (ERROR "missing :BAR argument")
98 :TYPE SOME-TYPE-TOO-HAIRY-TO-CONSTRUCT-AN-INSTANCE-OF))
100 (DECLAIM (FTYPE (FUNCTION () NIL) MISSING-ARG))
101 (DEFUN REQUIRED-ARG () ; workaround for SBCL non-ANSI slot init typing
102 (ERROR "missing required argument"))
104 (BAR (REQUIRED-ARG) :TYPE TRICKY-TYPE-OF-SOME-SORT)
105 (BLETCH (REQUIRED-ARG) :TYPE TRICKY-TYPE-OF-SOME-SORT)
106 (N-REFS-SO-FAR 0 :TYPE (INTEGER 0)))
107 Such code should compile without complaint and work correctly either
108 on SBCL or on any other completely compliant Common Lisp system.
111 And as long as we're wishing, it would be awfully nice if INSPECT could
112 also report on closures, telling about the values of the bound variables.
114 Currently INSPECT and DESCRIBE do show the values, but showing the
115 names of the bindings would be even nicer.
118 The compiler assumes that any time a function of declared FTYPE
119 doesn't signal an error, its arguments were of the declared type.
120 E.g. compiling and loading
121 (DECLAIM (OPTIMIZE (SAFETY 3)))
122 (DEFUN FACTORIAL (X) (GAMMA (1+ X)))
124 (DECLAIM (FTYPE (FUNCTION (UNSIGNED-BYTE)) FACTORIAL))
126 (COND ((> (FACTORIAL X) 1.0E6)
127 (FORMAT T "too big~%"))
129 (FORMAT T "exactly ~S~%" (FACTORIAL X)))
131 (FORMAT T "approximately ~S~%" (FACTORIAL X)))))
134 will cause the INTEGERP case to be selected, giving bogus output a la
136 This violates the "declarations are assertions" principle.
137 According to the ANSI spec, in the section "System Class FUNCTION",
138 this is a case of "lying to the compiler", but the lying is done
139 by the code which calls FACTORIAL with non-UNSIGNED-BYTE arguments,
140 not by the unexpectedly general definition of FACTORIAL. In any case,
141 "declarations are assertions" means that lying to the compiler should
142 cause an error to be signalled, and should not cause a bogus
143 result to be returned. Thus, the compiler should not assume
144 that arbitrary functions check their argument types. (It might
145 make sense to add another flag (CHECKED?) to DEFKNOWN to
146 identify functions which *do* check their argument types.)
147 (Also, verify that the compiler handles declared function
148 return types as assertions.)
151 The definitions of SIGCONTEXT-FLOAT-REGISTER and
152 %SET-SIGCONTEXT-FLOAT-REGISTER in x86-vm.lisp say they're not
153 supported on FreeBSD because the floating point state is not saved,
154 but at least as of FreeBSD 4.0, the floating point state *is* saved,
155 so they could be supported after all. Very likely
156 SIGCONTEXT-FLOATING-POINT-MODES could now be supported, too.
159 Compiling and loading
160 (DEFUN FAIL (X) (THROW 'FAIL-TAG X))
162 then requesting a BACKTRACE at the debugger prompt gives no information
163 about where in the user program the problem occurred.
165 (this is apparently mostly fixed on the SPARC, PPC, and x86 architectures:
166 while giving the backtrace the non-x86 systems complains about "unknown
167 source location: using block start", but apart from that the
168 backtrace seems reasonable. On x86 this is masked by bug 353. See
169 tests/debug.impure.lisp for a test case)
172 Using the pretty-printer from the command prompt gives funny
173 results, apparently because the pretty-printer doesn't know
174 about user's command input, including the user's carriage return
175 that the user, and therefore the pretty-printer thinks that
176 the new output block should start indented 2 or more characters
177 rightward of the correct location.
180 As reported by Winton Davies on a CMU CL mailing list 2000-01-10,
181 and reported for SBCL by Martin Atzmueller 2000-10-20: (TRACE GETHASH)
182 crashes SBCL. In general tracing anything which is used in the
183 implementation of TRACE is likely to have the same problem.
186 ANSI says in one place that type declarations can be abbreviated even
187 when the type name is not a symbol, e.g.
188 (DECLAIM ((VECTOR T) *FOOVECTOR*))
189 SBCL doesn't support this. But ANSI says in another place that this
190 isn't allowed. So it's not clear this is a bug after all. (See the
191 e-mail on cmucl-help@cons.org on 2001-01-16 and 2001-01-17 from WHN
194 (Actually this has changed changed since, and types as above are
195 now supported. This may be a bug.)
198 RANDOM-INTEGER-EXTRA-BITS=10 may not be large enough for the RANDOM
199 RNG to be high quality near RANDOM-FIXNUM-MAX; it looks as though
200 the mean of the distribution can be systematically O(0.1%) wrong.
201 Just increasing R-I-E-B is probably not a good solution, since
202 it would decrease efficiency more than is probably necessary. Perhaps
203 using some sort of accept/reject method would be better.
206 Internally the compiler sometimes evaluates
207 (sb-kernel:type/= (specifier-type '*) (specifier-type t))
208 (I stumbled across this when I added an
209 (assert (not (eq type1 *wild-type*)))
210 in the NAMED :SIMPLE-= type method.) '* isn't really a type, and
211 in a type context should probably be translated to T, and so it's
212 probably wrong to ask whether it's equal to the T type and then (using
213 the EQ type comparison in the NAMED :SIMPLE-= type method) return NIL.
214 (I haven't tried to investigate this bug enough to guess whether
215 there might be any user-level symptoms.)
217 In fact, the type system is likely to depend on this inequality not
218 holding... * is not equivalent to T in many cases, such as
219 (VECTOR *) /= (VECTOR T).
222 In sbcl-0.6.11.41 (and in all earlier SBCL, and in CMU
223 CL), out-of-line structure slot setters are horribly inefficient
224 whenever the type of the slot is declared, because out-of-line
225 structure slot setters are implemented as closures to save space,
226 so the compiler doesn't compile the type test into code, but
227 instead just saves the type in a lexical closure and interprets it
229 To exercise the problem, compile and load
230 (cl:in-package :cl-user)
232 (bar (error "missing") :type bar))
235 (loop (setf (foo-bar *foo*) x)))
237 (defvar *bar* (make-bar))
238 (defvar *foo* (make-foo :bar *bar*))
239 (defvar *setf-foo-bar* #'(setf foo-bar))
241 (loop (funcall *setf-foo-bar* x *foo*)))
242 then run (WASTREL1 *BAR*) or (WASTREL2 *BAR*), hit Ctrl-C, and
243 use BACKTRACE, to see it's spending all essentially all its time
244 in %TYPEP and VALUES-SPECIFIER-TYPE and so forth.
245 One possible solution would be simply to give up on
246 representing structure slot accessors as functions, and represent
247 them as macroexpansions instead. This can be inconvenient for users,
248 but it's not clear that it's worse than trying to help by expanding
249 into a horribly inefficient implementation.
250 As a workaround for the problem, #'(SETF FOO) expressions
251 can be replaced with (EFFICIENT-SETF-FUNCTION FOO), where
252 (defmacro efficient-setf-function (place-function-name)
253 (or #+sbcl (and (sb-int:info :function :accessor-for place-function-name)
254 ;; a workaround for the problem, encouraging the
255 ;; inline expansion of the structure accessor, so
256 ;; that the compiler can optimize its type test
257 (let ((new-value (gensym "NEW-VALUE-"))
258 (structure-value (gensym "STRUCTURE-VALUE-")))
259 `(lambda (,new-value ,structure-value)
260 (setf (,place-function-name ,structure-value)
262 ;; no problem, can just use the ordinary expansion
263 `(function (setf ,place-function-name))))
266 There's apparently a bug in CEILING optimization which caused
267 Douglas Crosher to patch the CMU CL version. Martin Atzmueller
268 applied the patches to SBCL and they didn't seem to cause problems
269 (as reported sbcl-devel 2001-05-04). However, since the patches
270 modify nontrivial code which was apparently written incorrectly
271 the first time around, until regression tests are written I'm not
272 comfortable merging the patches in the CVS version of SBCL.
277 a) ROOM works by walking over the heap linearly, instead of
278 following the object graph. Hence, it report garbage objects that
279 are unreachable. (Maybe this is a feature and not a bug?)
281 b) ROOM uses MAP-ALLOCATED-OBJECTS to walk the heap, which doesn't
282 check all pointers as well as it should, and can hence become
283 confused, leading to aver failures. As of 1.0.13.21 these (the
284 SAP= aver in particular) should be mostly under control, but push
285 ROOM hard enough and it still might croak.
288 When the compiler inline expands functions, it may be that different
289 kinds of return values are generated from different code branches.
290 E.g. an inline expansion of POSITION generates integer results
291 from one branch, and NIL results from another. When that inline
292 expansion is used in a context where only one of those results
295 (aref *a1* (position x *a2*)))
296 and the compiler can't prove that the unacceptable branch is
297 never taken, then bogus type mismatch warnings can be generated.
298 If you need to suppress the type mismatch warnings, you can
299 suppress the inline expansion,
301 #+sbcl (declare (notinline position)) ; to suppress bug 117 bogowarnings
302 (aref *a1* (position x *a2*)))
303 or, sometimes, suppress them by declaring the result to be of an
306 (aref *a1* (the integer (position x *a2*))))
308 This is not a new compiler problem in 0.7.0, but the new compiler
309 transforms for FIND, POSITION, FIND-IF, and POSITION-IF make it
310 more conspicuous. If you don't need performance from these functions,
311 and the bogus warnings are a nuisance for you, you can return to
312 your pre-0.7.0 state of grace with
313 #+sbcl (declaim (notinline find position find-if position-if)) ; bug 117..
318 As of version 0.pre7.14, SBCL's implementation of MACROLET makes
319 the entire lexical environment at the point of MACROLET available
320 in the bodies of the macroexpander functions. In particular, it
321 allows the function bodies (which run at compile time) to try to
322 access lexical variables (which are only defined at runtime).
323 It doesn't even issue a warning, which is bad.
325 The SBCL behavior arguably conforms to the ANSI spec (since the
326 spec says that the behavior is undefined, ergo anything conforms).
327 However, it would be better to issue a compile-time error.
328 Unfortunately I (WHN) don't see any simple way to detect this
329 condition in order to issue such an error, so for the meantime
330 SBCL just does this weird broken "conforming" thing.
332 The ANSI standard says, in the definition of the special operator
334 The macro-expansion functions defined by MACROLET are defined
335 in the lexical environment in which the MACROLET form appears.
336 Declarations and MACROLET and SYMBOL-MACROLET definitions affect
337 the local macro definitions in a MACROLET, but the consequences
338 are undefined if the local macro definitions reference any
339 local variable or function bindings that are visible in that
341 Then it seems to contradict itself by giving the example
343 (macrolet ((fudge (z)
344 ;The parameters x and flag are not accessible
345 ; at this point; a reference to flag would be to
346 ; the global variable of that name.
347 ` (if flag (* ,z ,z) ,z)))
348 ;The parameters x and flag are accessible here.
352 The comment "a reference to flag would be to the global variable
353 of the same name" sounds like good behavior for the system to have.
354 but actual specification quoted above says that the actual behavior
357 (Since 0.7.8.23 macroexpanders are defined in a restricted version
358 of the lexical environment, containing no lexical variables and
359 functions, which seems to conform to ANSI and CLtL2, but signalling
360 a STYLE-WARNING for references to variables similar to locals might
364 Ideally, uninterning a symbol would allow it, and its associated
365 FDEFINITION and PROCLAIM data, to be reclaimed by the GC. However,
366 at least as of sbcl-0.7.0, this isn't the case. Information about
367 FDEFINITIONs and PROCLAIMed properties is stored in globaldb.lisp
368 essentially in ordinary (non-weak) hash tables keyed by symbols.
369 Thus, once a system has an entry in this system, it tends to live
370 forever, even when it is uninterned and all other references to it
375 ANSI allows types `(COMPLEX ,FOO) to use very hairy values for
376 FOO, e.g. (COMPLEX (AND REAL (SATISFIES ODDP))). The old CMU CL
377 COMPLEX implementation didn't deal with this, and hasn't been
378 upgraded to do so. (This doesn't seem to be a high priority
379 conformance problem, since seems hard to construct useful code
382 [ partially fixed by CSR in 0.8.17.17 because of a PFD ansi-tests
383 report that (COMPLEX RATIO) was failing; still failing on types of
384 the form (AND NUMBER (SATISFIES REALP) (SATISFIES ZEROP)). ]
386 b. (fixed in 0.8.3.43)
389 Floating point errors are reported poorly. E.g. on x86 OpenBSD
392 debugger invoked on condition of type SB-KERNEL:FLOATING-POINT-EXCEPTION:
393 An arithmetic error SB-KERNEL:FLOATING-POINT-EXCEPTION was signalled.
394 No traps are enabled? How can this be?
395 It should be possible to be much more specific (overflow, division
396 by zero, etc.) and of course the "How can this be?" should be fixable.
398 See also bugs #45.c and #183
401 (reported by Robert E. Brown 2002-04-16)
402 When a function is called with too few arguments, causing the
403 debugger to be entered, the uninitialized slots in the bad call frame
404 seem to cause GCish problems, being interpreted as tagged data even
405 though they're not. In particular, executing ROOM in the
406 debugger at that point causes AVER failures:
409 * (lisp-implementation-version)
415 failed AVER: "(SAP= CURRENT END)"
416 (Christophe Rhodes reports that this doesn't occur on the SPARC, which
417 isn't too surprising since there are many differences in stack
418 implementation and GC conservatism between the X86 and other ports.)
420 (Can't reproduce on x86 linux as of 1.0.20.23 - MGL)
422 This is probably the same bug as 216
425 The compiler sometimes tries to constant-fold expressions before
426 it checks to see whether they can be reached. This can lead to
427 bogus warnings about errors in the constant folding, e.g. in code
430 (WRITE-STRING (> X 0) "+" "0"))
431 compiled in a context where the compiler can prove that X is NIL,
432 and the compiler complains that (> X 0) causes a type error because
433 NIL isn't a valid argument to #'>. Until sbcl-0.7.4.10 or so this
434 caused a full WARNING, which made the bug really annoying because then
435 COMPILE and COMPILE-FILE returned FAILURE-P=T for perfectly legal
436 code. Since then the warning has been downgraded to STYLE-WARNING,
437 so it's still a bug but at least it's a little less annoying.
439 183: "IEEE floating point issues"
440 Even where floating point handling is being dealt with relatively
441 well (as of sbcl-0.7.5, on sparc/sunos and alpha; see bug #146), the
442 accrued-exceptions and current-exceptions part of the fp control
443 word don't seem to bear much relation to reality. E.g. on
447 debugger invoked on condition of type DIVISION-BY-ZERO:
448 arithmetic error DIVISION-BY-ZERO signalled
449 0] (sb-vm::get-floating-point-modes)
451 (:TRAPS (:OVERFLOW :INVALID :DIVIDE-BY-ZERO)
452 :ROUNDING-MODE :NEAREST
453 :CURRENT-EXCEPTIONS NIL
454 :ACCRUED-EXCEPTIONS (:INEXACT)
457 * (sb-vm::get-floating-point-modes)
458 (:TRAPS (:OVERFLOW :INVALID :DIVIDE-BY-ZERO)
459 :ROUNDING-MODE :NEAREST
460 :CURRENT-EXCEPTIONS (:INEXACT)
461 :ACCRUED-EXCEPTIONS (:INEXACT)
464 188: "compiler performance fiasco involving type inference and UNION-TYPE"
468 (declare (optimize (safety 3)))
469 (declare (optimize (compilation-speed 2)))
470 (declare (optimize (speed 1) (debug 1) (space 1)))
472 (declare (type (integer 0) start))
473 (print (incf start 22))
474 (print (incf start 26))
475 (print (incf start 28)))
477 (declare (type (integer 0) start))
478 (print (incf start 22))
479 (print (incf start 26)))
481 (declare (type (integer 0) start))
482 (print (incf start 22))
483 (print (incf start 26))))))
485 [ Update: 1.0.14.36 improved this quite a bit (20-25%) by
486 eliminating useless work from PROPAGATE-FROM-SETS -- but as alluded
487 below, maybe we should be smarter about when to decide a derived
488 type is "good enough". ]
490 This example could be solved with clever enough constraint
491 propagation or with SSA, but consider
496 The careful type of X is {2k} :-(. Is it really important to be
497 able to work with unions of many intervals?
499 191: "Miscellaneous PCL deficiencies"
500 (reported by Alexey Dejneka sbcl-devel 2002-08-04)
501 a. DEFCLASS does not inform the compiler about generated
502 functions. Compiling a file with
506 (WITH-SLOTS (A-CLASS-X) A
508 results in a STYLE-WARNING:
510 SB-SLOT-ACCESSOR-NAME::|COMMON-LISP-USER A-CLASS-X slot READER|
512 APD's fix for this was checked in to sbcl-0.7.6.20, but Pierre
513 Mai points out that the declamation of functions is in fact
514 incorrect in some cases (most notably for structure
515 classes). This means that at present erroneous attempts to use
516 WITH-SLOTS and the like on classes with metaclass STRUCTURE-CLASS
517 won't get the corresponding STYLE-WARNING.
519 [much later, in 2006-08] in fact it's no longer erroneous to use
520 WITH-SLOTS on structure-classes. However, including :METACLASS
521 STRUCTURE-CLASS in the class definition gives a whole bunch of
522 function redefinition warnings, so we're still not good to close
525 c. (fixed in 0.8.4.23)
527 205: "environment issues in cross compiler"
528 (These bugs have no impact on user code, but should be fixed or
530 a. Macroexpanders introduced with MACROLET are defined in the null
532 b. The body of (EVAL-WHEN (:COMPILE-TOPLEVEL) ...) is evaluated in
533 the null lexical environment.
534 c. The cross-compiler cannot inline functions defined in a non-null
537 207: "poorly distributed SXHASH results for compound data"
538 SBCL's SXHASH could probably try a little harder. ANSI: "the
539 intent is that an implementation should make a good-faith
540 effort to produce hash-codes that are well distributed
541 within the range of non-negative fixnums". But
542 (let ((hits (make-hash-table)))
545 (let* ((ij (cons i j))
546 (newlist (push ij (gethash (sxhash ij) hits))))
548 (format t "~&collision: ~S~%" newlist))))))
549 reports lots of collisions in sbcl-0.7.8. A stronger MIX function
550 would be an obvious way of fix. Maybe it would be acceptably efficient
551 to redo MIX using a lookup into a 256-entry s-box containing
552 29-bit pseudorandom numbers?
554 211: "keywords processing"
555 a. :ALLOW-OTHER-KEYS T should allow a function to receive an odd
556 number of keyword arguments.
558 212: "Sequence functions and circular arguments"
559 COERCE, MERGE and CONCATENATE go into an infinite loop when given
560 circular arguments; it would be good for the user if they could be
561 given an error instead (ANSI 17.1.1 allows this behaviour on the part
562 of the implementation, as conforming code cannot give non-proper
563 sequences to these functions. MAP also has this problem (and
564 solution), though arguably the convenience of being able to do
565 (MAP 'LIST '+ FOO '#1=(1 . #1#))
566 might be classed as more important (though signalling an error when
567 all of the arguments are circular is probably desireable).
569 213: "Sequence functions and type checking"
570 b. MAP, when given a type argument that is SUBTYPEP LIST, does not
571 check that it will return a sequence of the given type. Fixing
572 it along the same lines as the others (cf. work done around
573 sbcl-0.7.8.45) is possible, but doing so efficiently didn't look
574 entirely straightforward.
575 c. All of these functions will silently accept a type of the form
577 whether or not the return value is of this type. This is
578 probably permitted by ANSI (see "Exceptional Situations" under
579 ANSI MAKE-SEQUENCE), but the DERIVE-TYPE mechanism does not
580 know about this escape clause, so code of the form
581 (INTEGERP (CAR (MAKE-SEQUENCE '(CONS INTEGER *) 2)))
582 can erroneously return T.
584 215: ":TEST-NOT handling by functions"
586 We should verify that our handling of :TEST-NOT and :TEST is consistent
587 for all functions that accept them: that is, signal an error if both
590 Similarly, a compile-time full warning for calls with both would be good.
592 We might also consider a compile-time style warning for :TEST-NOT.
594 216: "debugger confused by frames with invalid number of arguments"
595 In sbcl-0.7.8.51, executing e.g. (VECTOR-PUSH-EXTEND T), BACKTRACE, Q
596 leaves the system confused, enough so that (QUIT) no longer works.
597 It's as though the process of working with the uninitialized slot in
598 the bad VECTOR-PUSH-EXTEND frame causes GC problems, though that may
599 not be the actual problem. (CMU CL 18c doesn't have problems with this.)
601 (Can't reproduce on x86 linux as of 1.0.20.22 - MGL)
603 This is probably the same bug as 162
605 237: "Environment arguments to type functions"
606 a. Functions SUBTYPEP, TYPEP, UPGRADED-ARRAY-ELEMENT-TYPE, and
607 UPGRADED-COMPLEX-PART-TYPE now have an optional environment
608 argument, but they ignore it completely. This is almost
609 certainly not correct.
610 b. Also, the compiler's optimizers for TYPEP have not been informed
611 about the new argument; consequently, they will not transform
612 calls of the form (TYPEP 1 'INTEGER NIL), even though this is
613 just as optimizeable as (TYPEP 1 'INTEGER).
615 242: "WRITE-SEQUENCE suboptimality"
616 (observed from clx performance)
617 In sbcl-0.7.13, WRITE-SEQUENCE of a sequence of type
618 (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) on a stream with element-type
619 (UNSIGNED-BYTE 8) will write to the stream one byte at a time,
620 rather than writing the sequence in one go, leading to severe
621 performance degradation.
622 As of sbcl-0.9.0.36, this is solved for fd-streams, so is less of a
623 problem in practice. (Fully fixing this would require adding a
624 ansi-stream-n-bout slot and associated methods to write a byte
625 sequence to ansi-stream, similar to the existing ansi-stream-sout
628 243: "STYLE-WARNING overenthusiasm for unused variables"
629 (observed from clx compilation)
630 In sbcl-0.7.14, in the presence of the macros
631 (DEFMACRO FOO (X) `(BAR ,X))
632 (DEFMACRO BAR (X) (DECLARE (IGNORABLE X)) 'NIL)
633 somewhat surprising style warnings are emitted for
634 (COMPILE NIL '(LAMBDA (Y) (FOO Y))):
636 ; (LAMBDA (Y) (FOO Y))
638 ; caught STYLE-WARNING:
639 ; The variable Y is defined but never used.
641 245: bugs in disassembler
642 b. On X86 operand size prefix is not recognized.
645 (defun foo (&key (a :x))
649 does not cause a warning. (BTW: old SBCL issued a warning, but for a
650 function, which was never called!)
653 Compiler does not emit warnings for
655 a. (lambda () (svref (make-array 8 :adjustable t) 1))
657 b. (fixed at some point before 1.0.4.10)
660 (declare (optimize (debug 0)))
661 (declare (type vector x))
662 (list (fill-pointer x)
666 Complex array type does not have corresponding type specifier.
668 This is a problem because the compiler emits optimization notes when
669 you use a non-simple array, and without a type specifier for hairy
670 array types, there's no good way to tell it you're doing it
671 intentionally so that it should shut up and just compile the code.
673 Another problem is confusing error message "asserted type ARRAY
674 conflicts with derived type (VALUES SIMPLE-VECTOR &OPTIONAL)" during
675 compiling (LAMBDA (V) (VALUES (SVREF V 0) (VECTOR-POP V))).
677 The last problem is that when type assertions are converted to type
678 checks, types are represented with type specifiers, so we could lose
679 complex attribute. (Now this is probably not important, because
680 currently checks for complex arrays seem to be performed by
684 (compile nil '(lambda () (aref (make-array 0) 0))) compiles without
685 warning. Analogous cases with the index and length being equal and
686 greater than 0 are warned for; the problem here seems to be that the
687 type required for an array reference of this type is (INTEGER 0 (0))
688 which is canonicalized to NIL.
693 (t1 (specifier-type s)))
694 (eval `(defstruct ,s))
695 (type= t1 (specifier-type s)))
700 b. The same for CSUBTYPEP.
702 262: "yet another bug in inline expansion of local functions"
703 During inline expansion of a local function Python can try to
704 reference optimized away objects (functions, variables, CTRANs from
705 tags and blocks), which later may lead to problems. Some of the
706 cases are worked around by forbidding expansion in such cases, but
707 the better way would be to reimplement inline expansion by copying
711 David Lichteblau provided (sbcl-devel 2003-06-01) a patch to fix
712 behaviour of streams with element-type (SIGNED-BYTE 8). The patch
713 looks reasonable, if not obviously correct; however, it caused the
714 PPC/Linux port to segfault during warm-init while loading
715 src/pcl/std-class.fasl. A workaround patch was made, but it would
716 be nice to understand why the first patch caused problems, and to
717 fix the cause if possible.
719 268: "wrong free declaration scope"
720 The following code must signal type error:
722 (locally (declare (optimize (safety 3)))
723 (flet ((foo (x &optional (y (car x)))
724 (declare (optimize (safety 0)))
726 (funcall (eval #'foo) 1)))
729 In the following function constraint propagator optimizes nothing:
732 (declare (integer x))
733 (declare (optimize speed))
741 Compilation of the following two forms causes "X is unbound" error:
743 (symbol-macrolet ((x pi))
744 (macrolet ((foo (y) (+ x y)))
745 (declaim (inline bar))
751 (See (COERCE (CDR X) 'FUNCTION) in IR1-CONVERT-INLINE-LAMBDA.)
754 CLHS says that type declaration of a symbol macro should not affect
755 its expansion, but in SBCL it does. (If you like magic and want to
756 fix it, don't forget to change all uses of MACROEXPAND to
760 The following code (taken from CLOCC) takes a lot of time to compile:
763 (declare (type (integer 0 #.large-constant) n))
766 (fixed in 0.8.2.51, but a test case would be good)
768 279: type propagation error -- correctly inferred type goes astray?
769 In sbcl-0.8.3 and sbcl-0.8.1.47, the warning
770 The binding of ABS-FOO is a (VALUES (INTEGER 0 0)
771 &OPTIONAL), not a (INTEGER 1 536870911)
772 is emitted when compiling this file:
773 (declaim (ftype (function ((integer 0 #.most-positive-fixnum))
774 (integer #.most-negative-fixnum 0))
779 (let* (;; Uncomment this for a type mismatch warning indicating
780 ;; that the type of (FOO X) is correctly understood.
781 #+nil (fs-foo (float-sign (foo x)))
782 ;; Uncomment this for a type mismatch warning
783 ;; indicating that the type of (ABS (FOO X)) is
784 ;; correctly understood.
785 #+nil (fs-abs-foo (float-sign (abs (foo x))))
786 ;; something wrong with this one though
787 (abs-foo (abs (foo x))))
788 (declare (type (integer 1 100) abs-foo))
793 283: Thread safety: libc functions
794 There are places that we call unsafe-for-threading libc functions
795 that we should find alternatives for, or put locks around. Known or
796 strongly suspected problems, as of 1.0.3.13: please update this
797 bug instead of creating new ones
799 284: Thread safety: special variables
800 There are lots of special variables in SBCL, and I feel sure that at
801 least some of them are indicative of potentially thread-unsafe
802 parts of the system. See doc/internals/notes/threading-specials
804 286: "recursive known functions"
805 Self-call recognition conflicts with known function
806 recognition. Currently cross compiler and target COMPILE do not
807 recognize recursion, and in target compiler it can be disabled. We
808 can always disable it for known functions with RECURSIVE attribute,
809 but there remains a possibility of a function with a
810 (tail)-recursive simplification pass and transforms/VOPs for base
813 288: fundamental cross-compilation issues (from old UGLINESS file)
814 Using host floating point numbers to represent target floating point
815 numbers, or host characters to represent target characters, is
816 theoretically shaky. (The characters are OK as long as the characters
817 are in the ANSI-guaranteed character set, though, so they aren't a
818 real problem as long as the sources don't need anything but that;
819 the floats are a real problem.)
821 289: "type checking and source-transforms"
823 (block nil (let () (funcall #'+ (eval 'nil) (eval '1) (return :good))))
826 Our policy is to check argument types at the moment of a call. It
827 disagrees with ANSI, which says that type assertions are put
828 immediately onto argument expressions, but is easier to implement in
829 IR1 and is more compatible to type inference, inline expansion,
830 etc. IR1-transforms automatically keep this policy, but source
831 transforms for associative functions (such as +), being applied
832 during IR1-convertion, do not. It may be tolerable for direct calls
833 (+ x y z), but for (FUNCALL #'+ x y z) it is non-conformant.
835 b. Another aspect of this problem is efficiency. [x y + z +]
836 requires less registers than [x y z + +]. This transformation is
837 currently performed with source transforms, but it would be good to
838 also perform it in IR1 optimization phase.
840 290: Alpha floating point and denormalized traps
841 In SBCL 0.8.3.6x on the alpha, we work around what appears to be a
842 hardware or kernel deficiency: the status of the enable/disable
843 denormalized-float traps bit seems to be ambiguous; by the time we
844 get to os_restore_fp_control after a trap, denormalized traps seem
845 to be enabled. Since we don't want a trap every time someone uses a
846 denormalized float, in general, we mask out that bit when we restore
847 the control word; however, this clobbers any change the user might
851 LOOP with non-constant arithmetic step clauses suffers from overzealous
852 type constraint: code of the form
853 (loop for d of-type double-float from 0d0 to 10d0 by x collect d)
854 compiles to a type restriction on X of (AND DOUBLE-FLOAT (REAL
855 (0))). However, an integral value of X should be legal, because
856 successive adds of integers to double-floats produces double-floats,
857 so none of the type restrictions in the code is violated.
859 300: (reported by Peter Graves) Function PEEK-CHAR checks PEEK-TYPE
860 argument type only after having read a character. This is caused
861 with EXPLICIT-CHECK attribute in DEFKNOWN. The similar problem
862 exists with =, /=, <, >, <=, >=. They were fixed, but it is probably
863 less error prone to have EXPLICIT-CHECK be a local declaration,
864 being put into the definition, instead of an attribute being kept in
865 a separate file; maybe also put it into SB-EXT?
867 301: ARRAY-SIMPLE-=-TYPE-METHOD breaks on corner cases which can arise
868 in NOTE-ASSUMED-TYPES
869 In sbcl-0.8.7.32, compiling the file
871 (declare (type integer x))
872 (declare (type (vector (or hash-table bit)) y))
875 (declare (type integer x))
876 (declare (type (simple-array base (2)) y))
879 failed AVER: "(NOT (AND (NOT EQUALP) CERTAINP))"
881 303: "nonlinear LVARs" (aka MISC.293)
883 (multiple-value-call #'list
885 (multiple-value-prog1
886 (eval '(values :a :b :c))
892 (throw 'bar (values 3 4)))))))))))
894 (BUU 1) returns garbage.
896 The problem is that both EVALs sequentially write to the same LVAR.
898 306: "Imprecise unions of array types"
900 a. fixed in SBCL 0.9.15.48
905 ,@(loop for x across sb-vm:*specialized-array-element-type-properties*
906 collect `(array ,(sb-vm:saetp-specifier x)))))
907 => NIL, T (when it should be T, T)
909 309: "Dubious values for implementation limits"
910 (reported by Bruno Haible sbcl-devel "Incorrect value of
911 multiple-values-limit" 2004-04-19)
912 (values-list (make-list 1000000)), on x86/linux, signals a stack
913 exhaustion condition, despite MULTIPLE-VALUES-LIMIT being
914 significantly larger than 1000000. There are probably similar
915 dubious values for CALL-ARGUMENTS-LIMIT (see cmucl-help/cmucl-imp
916 around the same time regarding a call to LIST on sparc with 1000
917 arguments) and other implementation limit constants.
919 314: "LOOP :INITIALLY clauses and scope of initializers"
920 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
921 test suite, originally by Thomas F. Burdick.
922 ;; <http://www.lisp.org/HyperSpec/Body/sec_6-1-7-2.html>
923 ;; According to the HyperSpec 6.1.2.1.4, in for-as-equals-then, var is
924 ;; initialized to the result of evaluating form1. 6.1.7.2 says that
925 ;; initially clauses are evaluated in the loop prologue, which precedes all
926 ;; loop code except for the initial settings provided by with, for, or as.
927 (loop :for x = 0 :then (1+ x)
928 :for y = (1+ x) :then (ash y 1)
929 :for z :across #(1 3 9 27 81 243)
931 :initially (assert (zerop x)) :initially (assert (= 2 w))
932 :until (>= w 100) :collect w)
933 Expected: (2 6 15 38)
936 318: "stack overflow in compiler warning with redefined class"
937 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
940 (setf (find-class 'foo) nil)
941 (defstruct foo slot-1)
942 This used to give a stack overflow from within the printer, which has
943 been fixed as of 0.8.16.11. Current result:
945 ; can't compile TYPEP of anonymous or undefined class:
946 ; #<SB-KERNEL:STRUCTURE-CLASSOID FOO>
948 debugger invoked on a TYPE-ERROR in thread 19973:
949 The value NIL is not of type FUNCTION.
951 CSR notes: it's not really clear what it should give: is (SETF FIND-CLASS)
952 meant to be enough to delete structure classes from the system?
954 319: "backquote with comma inside array"
955 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
957 (read-from-string "`#1A(1 2 ,(+ 2 2) 4)")
959 #(1 2 ((SB-IMPL::|,|) + 2 2) 4)
960 which probably isn't intentional.
962 324: "STREAMs and :ELEMENT-TYPE with large bytesize"
963 In theory, (open foo :element-type '(unsigned-byte <x>)) should work
964 for all positive integral <x>. At present, it only works for <x> up
965 to about 1024 (and similarly for signed-byte), so
966 (open "/dev/zero" :element-type '(unsigned-byte 1025))
967 gives an error in sbcl-0.8.10.
969 325: "CLOSE :ABORT T on superseding streams"
970 Closing a stream opened with :IF-EXISTS :SUPERSEDE with :ABORT T leaves no
971 file on disk, even if one existed before opening.
973 The illegality of this is not crystal clear, as the ANSI dictionary
974 entry for CLOSE says that when :ABORT is T superseded files are not
975 superseded (ie. the original should be restored), whereas the OPEN
976 entry says about :IF-EXISTS :SUPERSEDE "If possible, the
977 implementation should not destroy the old file until the new stream
978 is closed." -- implying that even though undesirable, early deletion
979 is legal. Restoring the original would none the less be the polite
982 326: "*PRINT-CIRCLE* crosstalk between streams"
983 In sbcl-0.8.10.48 it's possible for *PRINT-CIRCLE* references to be
984 mixed between streams when output operations are intermingled closely
985 enough (as by doing output on S2 from within (PRINT-OBJECT X S1) in the
986 test case below), so that e.g. the references #2# appears on a stream
987 with no preceding #2= on that stream to define it (because the #2= was
988 sent to another stream).
989 (cl:in-package :cl-user)
990 (defstruct foo index)
991 (defparameter *foo* (make-foo :index 4))
993 (defparameter *bar* (make-bar))
994 (defparameter *tangle* (list *foo* *bar* *foo*))
995 (defmethod print-object ((foo foo) stream)
996 (let ((index (foo-index foo)))
997 (format *trace-output*
998 "~&-$- emitting FOO ~D, ambient *BAR*=~S~%"
1000 (format stream "[FOO ~D]" index))
1002 (let ((tsos (make-string-output-stream))
1003 (ssos (make-string-output-stream)))
1004 (let ((*print-circle* t)
1005 (*trace-output* tsos)
1006 (*standard-output* ssos))
1007 (prin1 *tangle* *standard-output*))
1008 (let ((string (get-output-stream-string ssos)))
1009 (unless (string= string "(#1=[FOO 4] #S(BAR) #1#)")
1010 ;; In sbcl-0.8.10.48 STRING was "(#1=[FOO 4] #2# #1#)".:-(
1011 (error "oops: ~S" string)))))
1012 It might be straightforward to fix this by turning the
1013 *CIRCULARITY-HASH-TABLE* and *CIRCULARITY-COUNTER* variables into
1014 per-stream slots, but (1) it would probably be sort of messy faking
1015 up the special variable binding semantics using UNWIND-PROTECT and
1016 (2) it might be sort of a pain to test that no other bugs had been
1019 328: "Profiling generic functions", transplanted from #241
1020 (from tonyms on #lisp IRC 2003-02-25)
1021 In sbcl-0.7.12.55, typing
1022 (defclass foo () ((bar :accessor foo-bar)))
1025 (defclass foo () ((bar :accessor foo-bar)))
1026 gives the error message
1027 "#:FOO-BAR already names an ordinary function or a macro."
1029 Problem: when a generic function is profiled, it appears as an ordinary
1030 function to PCL. (Remembering the uninterned accessor is OK, as the
1031 redefinition must be able to remove old accessors from their generic
1034 329: "Sequential class redefinition"
1035 reported by Bruno Haible:
1036 (defclass reactor () ((max-temp :initform 10000000)))
1037 (defvar *r1* (make-instance 'reactor))
1038 (defvar *r2* (make-instance 'reactor))
1039 (slot-value *r1* 'max-temp)
1040 (slot-value *r2* 'max-temp)
1041 (defclass reactor () ((uptime :initform 0)))
1042 (slot-value *r1* 'uptime)
1043 (defclass reactor () ((uptime :initform 0) (max-temp :initform 10000)))
1044 (slot-value *r1* 'max-temp) ; => 10000
1045 (slot-value *r2* 'max-temp) ; => 10000000 oops...
1048 The method effective when the wrapper is obsoleted can be saved
1049 in the wrapper, and then to update the instance just run through
1050 all the old wrappers in order from oldest to newest.
1052 336: "slot-definitions must retain the generic functions of accessors"
1053 reported by Tony Martinez:
1054 (defclass foo () ((bar :reader foo-bar)))
1055 (defun foo-bar (x) x)
1056 (defclass foo () ((bar :reader get-bar))) ; => error, should work
1058 Note: just punting the accessor removal if the fdefinition
1059 is not a generic function is not enough:
1061 (defclass foo () ((bar :reader foo-bar)))
1062 (defvar *reader* #'foo-bar)
1063 (defun foo-bar (x) x)
1064 (defclass foo () ((bar :initform 'ok :reader get-bar)))
1065 (funcall *reader* (make-instance 'foo)) ; should be an error, since
1066 ; the method must be removed
1067 ; by the class redefinition
1069 Fixing this should also fix a subset of #328 -- update the
1070 description with a new test-case then.
1072 339: "DEFINE-METHOD-COMBINATION bugs"
1073 (reported by Bruno Haible via the clisp test suite)
1075 a. Syntax checking laxity (should produce errors):
1076 i. (define-method-combination foo :documentation :operator)
1077 ii. (define-method-combination foo :documentation nil)
1078 iii. (define-method-combination foo nil)
1079 iv. (define-method-combination foo nil nil
1080 (:arguments order &aux &key))
1081 v. (define-method-combination foo nil nil (:arguments &whole))
1082 vi. (define-method-combination foo nil nil (:generic-function))
1083 vii. (define-method-combination foo nil nil (:generic-function bar baz))
1084 viii. (define-method-combination foo nil nil (:generic-function (bar)))
1085 ix. (define-method-combination foo nil ((3)))
1086 x. (define-method-combination foo nil ((a)))
1088 b. define-method-combination arguments lambda list badness
1089 i. &aux args are currently unsupported;
1090 ii. default values of &optional and &key arguments are ignored;
1091 iii. supplied-p variables for &optional and &key arguments are not
1094 c. (fixed in sbcl-0.9.15.15)
1096 344: more (?) ROOM T problems (possibly part of bug 108)
1097 In sbcl-0.8.12.51, and off and on leading up to it, the
1098 SB!VM:MEMORY-USAGE operations in ROOM T caused
1099 unhandled condition (of type SB-INT:BUG):
1100 failed AVER: "(SAP= CURRENT END)"
1101 Several clever people have taken a shot at this without fixing
1102 it; this time around (before sbcl-0.8.13 release) I (WHN) just
1103 commented out the SB!VM:MEMORY-USAGE calls until someone figures
1104 out how to make them work reliably with the rest of the GC.
1106 (Note: there's at least one dubious thing in room.lisp: see the
1107 comment in VALID-OBJ)
1109 346: alpha backtrace
1110 In sbcl-0.8.13, all backtraces from errors caused by internal errors
1111 on the alpha seem to have a "bogus stack frame".
1113 349: PPRINT-INDENT rounding implementation decisions
1114 At present, pprint-indent (and indeed the whole pretty printer)
1115 more-or-less assumes that it's using a monospace font. That's
1116 probably not too silly an assumption, but one piece of information
1117 the current implementation loses is from requests to indent by a
1118 non-integral amount. As of sbcl-0.8.15.9, the system silently
1119 truncates the indentation to an integer at the point of request, but
1120 maybe the non-integral value should be propagated through the
1121 pprinter and only truncated at output? (So that indenting by 1/2
1122 then 3/2 would indent by two spaces, not one?)
1124 352: forward-referenced-class trouble
1125 reported by Bruno Haible on sbcl-devel
1127 (setf (class-name (find-class 'a)) 'b)
1131 Expected: an instance of c, with a slot named x
1132 Got: debugger invoked on a SIMPLE-ERROR in thread 78906:
1133 While computing the class precedence list of the class named C.
1134 The class named B is a forward referenced class.
1135 The class named B is a direct superclass of the class named C.
1137 [ Is this actually a bug? DEFCLASS only replaces an existing class
1138 when the class name is the proper name of that class, and in the
1139 above code the class found by (FIND-CLASS 'A) does not have a
1140 proper name. CSR, 2006-08-07 ]
1142 353: debugger suboptimalities on x86
1143 On x86 backtraces for undefined functions start with a bogus stack
1144 frame, and backtraces for throws to unknown catch tags with a "no
1145 debug information" frame. These are both due to CODE-COMPONENT-FROM-BITS
1146 (used on non-x86 platforms) being a more complete solution then what
1149 On x86/linux large portions of tests/debug.impure.lisp have been commented
1150 out as failures. The probable culprit for these problems is in x86-call-context
1151 (things work fine on x86/freebsd).
1153 More generally, the debugger internals suffer from excessive x86/non-x86
1154 conditionalization and OAOOMization: refactoring the common parts would
1158 (reported by Bruno Haible)
1159 After the "layout depth conflict" error, the CLOS is left in a state where
1160 it's not possible to define new standard-class subclasses any more.
1162 (defclass prioritized-dispatcher ()
1163 ((dependents :type list :initform nil)))
1164 (defmethod sb-pcl:validate-superclass ((c1 sb-pcl:funcallable-standard-class)
1165 (c2 (eql (find-class 'prioritized-dispatcher))))
1167 (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
1169 (:metaclass sb-pcl:funcallable-standard-class))
1170 ;; ERROR, Quit the debugger with ABORT
1171 (defclass typechecking-reader-class (standard-class)
1173 Expected: #<STANDARD-CLASS TYPECHECKING-READER-CLASS>
1174 Got: ERROR "The assertion SB-PCL::WRAPPERS failed."
1176 [ This test case does not cause the error any more. However,
1177 similar problems can be observed with
1179 (defclass foo (standard-class) ()
1180 (:metaclass sb-mop:funcallable-standard-class))
1181 (sb-mop:finalize-inheritance (find-class 'foo))
1183 (defclass bar (standard-class) ())
1184 (make-instance 'bar)
1187 359: wrong default value for ensure-generic-function's :generic-function-class argument
1188 (reported by Bruno Haible)
1189 ANSI CL is silent on this, but the MOP's specification of ENSURE-GENERIC-FUNCTION says:
1190 "The remaining arguments are the complete set of keyword arguments
1191 received by ENSURE-GENERIC-FUNCTION."
1192 and the spec of ENSURE-GENERIC-FUNCTION-USING-CLASS:
1193 ":GENERIC-FUNCTION-CLASS - a class metaobject or a class name. If it is not
1194 supplied, it defaults to the class named STANDARD-GENERIC-FUNCTION."
1195 This is not the case in SBCL. Test case:
1196 (defclass my-generic-function (standard-generic-function)
1198 (:metaclass sb-pcl:funcallable-standard-class))
1199 (setf (fdefinition 'foo1)
1200 (make-instance 'my-generic-function :name 'foo1))
1201 (ensure-generic-function 'foo1
1202 :generic-function-class (find-class 'standard-generic-function))
1204 ; => #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
1205 (setf (fdefinition 'foo2)
1206 (make-instance 'my-generic-function :name 'foo2))
1207 (ensure-generic-function 'foo2)
1209 Expected: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
1210 Got: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS MY-GENERIC-FUNCTION>
1212 362: missing error when a slot-definition is created without a name
1213 (reported by Bruno Haible)
1214 The MOP says about slot-definition initialization:
1215 "The :NAME argument is a slot name. An ERROR is SIGNALled if this argument
1216 is not a symbol which can be used as a variable name. An ERROR is SIGNALled
1217 if this argument is not supplied."
1219 (make-instance (find-class 'sb-pcl:standard-direct-slot-definition))
1221 Got: #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION NIL>
1223 363: missing error when a slot-definition is created with a wrong documentation object
1224 (reported by Bruno Haible)
1225 The MOP says about slot-definition initialization:
1226 "The :DOCUMENTATION argument is a STRING or NIL. An ERROR is SIGNALled
1227 if it is not. This argument default to NIL during initialization."
1229 (make-instance (find-class 'sb-pcl:standard-direct-slot-definition)
1231 :documentation 'not-a-string)
1233 Got: #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION FOO>
1235 370: reader misbehaviour on large-exponent floats
1236 (read-from-string "1.0s1000000000000000000000000000000000000000")
1237 causes the reader to attempt to create a very large bignum (which it
1238 will then attempt to coerce to a rational). While this isn't
1239 completely wrong, it is probably not ideal -- checking the floating
1240 point control word state and then returning the relevant float
1241 (most-positive-short-float or short-float-infinity) or signalling an
1242 error immediately would seem to make more sense.
1244 372: floating-point overflow not signalled on ppc/darwin
1245 The following assertions in float.pure.lisp fail on ppc/darwin
1246 (Mac OS X version 10.3.7):
1247 (assert (raises-error? (scale-float 1.0 most-positive-fixnum)
1248 floating-point-overflow))
1249 (assert (raises-error? (scale-float 1.0d0 (1+ most-positive-fixnum))
1250 floating-point-overflow)))
1251 as the SCALE-FLOAT just returns
1252 #.SB-EXT:SINGLE/DOUBLE-FLOAT-POSITIVE-INFINITY. These tests have been
1253 disabled on Darwin for now.
1255 377: Memory fault error reporting
1256 On those architectures where :C-STACK-IS-CONTROL-STACK is in
1257 *FEATURES*, we handle SIG_MEMORY_FAULT (SEGV or BUS) on an altstack,
1258 so we cannot handle the signal directly (as in interrupt_handle_now())
1259 in the case when the signal comes from some external agent (the user
1260 using kill(1), or a fault in some foreign code, for instance). As
1261 of sbcl-0.8.20.20, this is fixed by calling
1262 arrange_return_to_lisp_function() to a new error-signalling
1263 function, but as a result the error reporting is poor: we cannot
1264 even tell the user at which address the fault occurred. We should
1265 arrange such that arguments can be passed to the function called from
1266 arrange_return_to_lisp_function(), but this looked hard to do in
1267 general without suffering from memory leaks.
1269 379: TRACE :ENCAPSULATE NIL broken on ppc/darwin
1270 See commented-out test-case in debug.impure.lisp.
1272 382: externalization unexpectedly changes array simplicity
1273 COMPILE-FILE and LOAD
1275 (let ((x #.(make-array 4 :fill-pointer 0)))
1276 (values (eval `(typep ',x 'simple-array))
1277 (typep x 'simple-array))))
1278 then (FOO) => T, NIL.
1280 Similar problems exist with SIMPLE-ARRAY-P, ARRAY-HEADER accessors
1281 and all array dimension functions.
1283 383: ASH'ing non-constant zeros
1286 (declare (type (integer -2 14) b))
1287 (declare (ignorable b))
1288 (ash (imagpart b) 57))
1289 on PPC (and other platforms, presumably) gives an error during the
1290 emission of FASH-ASH-LEFT/FIXNUM=>FIXNUM as the assembler attempts to
1291 stuff a too-large constant into the immediate field of a PPC
1292 instruction. Either the VOP should be fixed or the compiler should be
1293 taught how to transform this case away, paying particular attention
1294 to side-effects that might occur in the arguments to ASH.
1296 384: Compiler runaway on very large character types
1298 (compile nil '(lambda (x)
1299 (declare (type (member #\a 1) x))
1300 (the (member 1 nil) x)))
1302 The types apparently normalize into a very large type, and the compiler
1303 gets lost in REMOVE-DUPLICATES. Perhaps the latter should use
1304 a better algorithm (one based on hash tables, say) on very long lists
1305 when :TEST has its default value?
1309 (compile nil '(lambda (x) (the (not (eql #\a)) x)))
1311 (partially fixed in 0.9.3.1, but a better representation for these
1315 (format nil "~4,1F" 0.001) => "0.00" (should be " 0.0");
1316 (format nil "~4,1@F" 0.001) => "+.00" (should be "+0.0").
1317 (format nil "~E" 0.01) => "10.e-3" (should be "1.e-2");
1318 (format nil "~G" 0.01) => "10.e-3" (should be "1.e-2");
1320 386: SunOS/x86 stack exhaustion handling broken
1321 According to <http://alfa.s145.xrea.com/sbcl/solaris-x86.html>, the
1322 stack exhaustion checking (implemented with a write-protected guard
1323 page) does not work on SunOS/x86.
1326 (found by Dmitry Bogomolov)
1328 (defclass foo () ((x :type (unsigned-byte 8))))
1329 (defclass bar () ((x :type symbol)))
1330 (defclass baz (foo bar) ())
1334 SB-PCL::SPECIALIZER-APPLICABLE-USING-TYPE-P cannot handle the second argument
1337 [ Can't trigger this any more, as of 2006-08-07 ]
1340 (reported several times on sbcl-devel, by Rick Taube, Brian Rowe and
1343 ROUND-NUMERIC-BOUND assumes that float types always have a FORMAT
1344 specifying whether they're SINGLE or DOUBLE. This is true for types
1345 computed by the type system itself, but the compiler type derivation
1346 short-circuits this and constructs non-canonical types. A temporary
1347 fix was made to ROUND-NUMERIC-BOUND for the sbcl-0.9.6 release, but
1348 the right fix is to remove the abstraction violation in the
1349 compiler's type deriver.
1351 393: Wrong error from methodless generic function
1352 (DEFGENERIC FOO (X))
1354 gives NO-APPLICABLE-METHOD rather than an argument count error.
1356 396: block-compilation bug
1360 (when (funcall (eval #'(lambda (x) (eql x 2))) y)
1362 (incf x (incf y z))))))
1366 (bar 1) => 11, should be 4.
1369 The more interrupts arrive the less accurate SLEEP's timing gets.
1370 (time (sb-thread:terminate-thread
1371 (prog1 (sb-thread:make-thread (lambda ()
1378 398: GC-unsafe SB-ALIEN string deporting
1379 Translating a Lisp string to an alien string by taking a SAP to it
1380 as done by the :DEPORT-GEN methods for C-STRING and UTF8-STRING
1381 is not safe, since the Lisp string can move. For example the
1382 following code will fail quickly on both cheneygc and pre-0.9.8.19
1385 (setf (bytes-consed-between-gcs) 4096)
1386 (define-alien-routine "strcmp" int (s1 c-string) (s2 c-string))
1389 (let ((string "hello, world"))
1390 (assert (zerop (strcmp string string)))))
1392 (This will appear to work on post-0.9.8.19 GENCGC, since
1393 the GC no longer zeroes memory immediately after releasing
1394 it after a minor GC. Either enabling the READ_PROTECT_FREE_PAGES
1395 #define in gencgc.c or modifying the example so that a major
1396 GC will occasionally be triggered would unmask the bug.)
1398 On cheneygc the only solution would seem to be allocating some alien
1399 memory, copying the data over, and arranging that it's freed once we
1400 return. For GENCGC we could instead try to arrange that the string
1401 from which the SAP is taken is always pinned.
1403 For some more details see comments for (define-alien-type-method
1404 (c-string :deport-gen) ...) in host-c-call.lisp.
1406 403: FORMAT/PPRINT-LOGICAL-BLOCK of CONDITIONs ignoring *PRINT-CIRCLE*
1409 (make-condition 'simple-error
1410 :format-control "ow... ~S"
1411 :format-arguments '(#1=(#1#))))
1412 (setf *print-circle* t *print-level* 4)
1413 (format nil "~@<~A~:@>" *c*)
1416 where I (WHN) believe the correct result is "ow... #1=(#1#)",
1417 like the result from (PRINC-TO-STRING *C*). The question of
1418 what the correct result is is complicated by the hairy text in
1419 the Hyperspec "22.3.5.2 Tilde Less-Than-Sign: Logical Block",
1420 Other than the difference in its argument, ~@<...~:> is
1421 exactly the same as ~<...~:> except that circularity detection
1422 is not applied if ~@<...~:> is encountered at top level in a
1424 But because the odd behavior happens even without the at-sign,
1425 (format nil "~<~A~:@>" (list *c*)) ; => "ow... (((#)))"
1426 and because something seemingly similar can happen even in
1427 PPRINT-LOGICAL-BLOCK invoked directly without FORMAT,
1428 (pprint-logical-block (*standard-output* '(some nonempty list))
1429 (format *standard-output* "~A" '#1=(#1#)))
1430 (which prints "(((#)))" to *STANDARD-OUTPUT*), I don't think
1431 that the 22.3.5.2 trickiness is fundamental to the problem.
1433 My guess is that the problem is related to the logic around the MODE
1434 argument to CHECK-FOR-CIRCULARITY, but I haven't reverse-engineered
1435 enough of the intended meaning of the different MODE values to be
1438 404: nonstandard DWIMness in LOOP with unportably-ordered clauses
1439 In sbcl-0.9.13, the code
1440 (loop with stack = (make-array 2 :fill-pointer 2 :initial-element t)
1441 for length = (length stack)
1442 while (plusp length)
1443 for element = (vector-pop stack)
1445 compiles without error or warning and returns (T T). Unfortunately,
1446 it is inconsistent with the ANSI definition of the LOOP macro,
1447 because it mixes up VARIABLE-CLAUSEs with MAIN-CLAUSEs. Furthermore,
1448 SBCL's interpretation of the intended meaning is only one possible,
1449 unportable interpretation of the noncompliant code; in CLISP 2.33.2,
1450 the code compiles with a warning
1451 LOOP: FOR clauses should occur before the loop's main body
1452 and then fails at runtime with
1453 VECTOR-POP: #() has length zero
1454 perhaps because CLISP has shuffled the clauses into an
1455 ANSI-compliant order before proceeding.
1457 406: functional has external references -- failed aver
1458 Given the following food in a single file
1459 (eval-when (:compile-toplevel :load-toplevel :execute)
1462 (foo #.(make-foo3)))
1463 as of 0.9.18.11 the file compiler breaks on it:
1464 failed AVER: "(NOT (FUNCTIONAL-HAS-EXTERNAL-REFERENCES-P CLAMBDA))"
1465 Defining the missing MAKE-LOAD-FORM method makes the error go away.
1467 407: misoptimization of loop, COERCE 'FLOAT, and HANDLER-CASE for bignums
1468 (reported by Ariel Badichi on sbcl-devel 2007-01-09)
1469 407a: In sbcl-1.0.1 on Linux x86,
1471 (loop for n from (expt 2 1024) do
1473 (coerce n 'single-float)
1474 (simple-type-error ()
1475 (format t "Got here.~%")
1476 (return-from foo)))))
1478 causes an infinite loop, where handling the error would be expected.
1479 407b: In sbcl-1.0.1 on Linux x86,
1481 (loop for n from (expt 2 1024) do
1483 (format t "~E~%" (coerce n 'single-float))
1484 (simple-type-error ()
1485 (format t "Got here.~%")
1486 (return-from bar)))))
1487 fails to compile, with
1488 Too large to be represented as a SINGLE-FLOAT: ...
1490 0: ((LABELS SB-BIGNUM::CHECK-EXPONENT) ...)
1491 1: ((LABELS SB-BIGNUM::FLOAT-FROM-BITS) ...)
1492 2: (SB-KERNEL:%SINGLE-FLOAT ...)
1493 3: (SB-C::BOUND-FUNC ...)
1494 4: (SB-C::%SINGLE-FLOAT-DERIVE-TYPE-AUX ...)
1496 These are now fixed, but (COERCE HUGE 'SINGLE-FLOAT) still signals a
1497 type-error at runtime. The question is, should it instead signal a
1498 floating-point overflow, or return an infinity?
1500 408: SUBTYPEP confusion re. OR of SATISFIES of not-yet-defined predicate
1501 As reported by Levente M\'{e}sz\'{a}ros sbcl-devel 2006-02-20,
1502 (aver (equal (multiple-value-list
1503 (subtypep '(or (satisfies x) string)
1504 '(or (satisfies x) integer)))
1506 fails. Also, beneath that failure lurks another failure,
1507 (aver (equal (multiple-value-list
1509 '(or (satisfies x) integer)))
1511 Having looked at this for an hour or so in sbcl-1.0.2, and
1512 specifically having looked at the output from
1515 (y '(or (satisfies x) integer)))
1516 (trace sb-kernel::union-complex-subtypep-arg2
1517 sb-kernel::invoke-complex-subtypep-arg1-method
1518 sb-kernel::type-union
1519 sb-kernel::type-intersection
1522 my (WHN) impression is that the problem is that the semantics of TYPE=
1523 are wrong for what the UNION-COMPLEX-SUBTYPEP-ARG2 code is trying
1524 to use it for. The comments on the definition of TYPE= probably
1525 date back to CMU CL and seem to define it as a confusing thing:
1526 its primary value is something like "certainly equal," and its
1527 secondary value is something like "certain about that certainty."
1528 I'm left uncertain how to fix UNION-COMPLEX-SUBTYPEP-ARG2 without
1529 reducing its generality by removing the TYPE= cleverness. Possibly
1530 the tempting TYPE/= relative defined next to it might be a
1531 suitable replacement for the purpose. Probably, though, it would
1532 be best to start by reverse engineering exactly what TYPE= and
1533 TYPE/= do, and writing an explanation which is so clear that one
1534 can see immediately what it's supposed to mean in odd cases like
1535 (TYPE= '(SATISFIES X) 'INTEGER) when X isn't defined yet.
1537 409: MORE TYPE SYSTEM PROBLEMS
1538 Found while investigating an optimization failure for extended
1539 sequences. The extended sequence type implementation was altered to
1540 work around the problem, but the fundamental problem remains, to wit:
1541 (sb-kernel:type= (sb-kernel:specifier-type '(or float ratio))
1542 (sb-kernel:specifier-type 'single-float))
1543 returns NIL, NIL on sbcl-1.0.3.
1544 (probably related to bug #408)
1546 410: read circularities and type declarations
1547 Consider the definition
1548 (defstruct foo (a 0 :type (not symbol)))
1550 (setf *print-circle* t) ; just in case
1551 (read-from-string "#1=#s(foo :a #1#)")
1552 This gives a type error (#:G1 is not a (NOT SYMBOL)) because of the
1553 implementation of read circularity, using a symbol as a marker for
1554 the previously-referenced object.
1556 416: backtrace confusion
1567 gives the correct error, but the backtrace shows
1568 1: (SB-KERNEL:FDEFINITION-OBJECT 13 NIL)
1569 as the second frame.
1571 418: SUBSEQ on lists doesn't support bignum indexes
1573 LIST-SUBSEQ* now has all the works necessary to support bignum indexes,
1574 but it needs to be verified that changing the DEFKNOWN doesn't kill
1575 performance elsewhere.
1577 Other generic sequence functions have this problem as well.
1579 419: stack-allocated indirect closure variables are not popped
1582 (multiple-value-call #'list
1583 (eval '(values 1 2 3))
1585 (declare (sb-int:truly-dynamic-extent x))
1590 (declare (dynamic-extent #'mget #'mset))
1591 ((lambda (f g) (eval `(progn ,f ,g (values 4 5 6)))) #'mget #'mset)))))
1593 (ASSERT (EQUAL (BUG419 42) '(1 2 3 4 5 6))) => failure
1595 Note: as of SBCL 1.0.16.29 this bug no longer affects user code, as
1596 SB-INT:TRULY-DYNAMIC-EXTENT needs to be used instead of
1597 DYNAMIC-EXTENT for this to happen. Proper fix for this bug requires
1598 (Nikodemus thinks) storing the relevant LAMBDA-VARs in a
1599 :DYNAMIC-EXTENT cleanup, and teaching stack analysis how to deal
1602 421: READ-CHAR-NO-HANG misbehaviour on Windows Console:
1604 It seems that on Windows READ-CHAR-NO-HANG hangs if the user
1605 has pressed a key, but not yet enter (ie. SYSREAD-MAY-BLOCK-P
1606 seems to lie if the OS is buffering input for us on Console.)
1608 reported by Elliot Slaughter on sbcl-devel 2008/1/10.
1610 422: out-of-extent return not checked in safe code
1612 (declaim (optimize safety))
1613 (funcall (catch 't (block nil (throw 't (lambda () (return))))))
1615 behaves ...erratically. Reported by Kevin Reid on sbcl-devel
1616 2007-07-06. (We don't _have_ to check things like this, but we
1617 generally try to check returns in safe code, so we should here too.)
1619 424: toplevel closures and *CHECK-CONSISTENCY*
1621 The following breaks under COMPILE-FILE if *CHECK-CONSISTENCY* is true.
1623 (let ((exported-symbols-alist
1624 (loop for symbol being the external-symbols of :cl
1625 collect (cons symbol
1626 (concatenate 'string
1628 (string-downcase symbol))))))
1629 (defun hyperdoc-lookup (symbol)
1630 (cdr (assoc symbol exported-symbols-alist))))
1632 (Test-case adapted from CL-PPCRE.)
1634 428: TIMER SCHEDULE-STRESS and PARALLEL-UNSCHEDULE in
1635 timer.impure.lisp fails
1637 Failure modes vary. Core problem seems to be (?) recursive entry to
1642 Compiling a file with this contents makes the compiler loop in
1645 (declaim (inline storage))
1647 (the (simple-array flt (*)) (unknown x)))
1649 (defun test1 (lumps &key cg)
1650 (let ((nodes (map 'list (lambda (lump) (storage lump))
1652 (setf (aref nodes 0) 2)
1653 (assert (every #'~= (apply #'concatenate 'list nodes) '(2 3 6 9)))))
1655 431: alien strucure redefinition doesn't work as expected