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.
27 There is also some information on bugs in the manual page and
28 in the TODO file. Eventually more such information may move here.
30 The gaps in the number sequence belong to old bug descriptions which
31 have gone away (typically because they were fixed, but sometimes for
32 other reasons, e.g. because they were moved elsewhere).
36 DEFSTRUCT almost certainly should overwrite the old LAYOUT information
37 instead of just punting when a contradictory structure definition
38 is loaded. As it is, if you redefine DEFSTRUCTs in a way which
39 changes their layout, you probably have to rebuild your entire
40 program, even if you know or guess enough about the internals of
41 SBCL to wager that this (undefined in ANSI) operation would be safe.
43 3: "type checking of structure slots"
45 ANSI specifies that a type mismatch in a structure slot
46 initialization value should not cause a warning.
48 This one might not be fixed for a while because while we're big
49 believers in ANSI compatibility and all, (1) there's no obvious
50 simple way to do it (short of disabling all warnings for type
51 mismatches everywhere), and (2) there's a good portable
52 workaround, and (3) by their own reasoning, it looks as though
53 ANSI may have gotten it wrong. ANSI justifies this specification
55 The restriction against issuing a warning for type mismatches
56 between a slot-initform and the corresponding slot's :TYPE
57 option is necessary because a slot-initform must be specified
58 in order to specify slot options; in some cases, no suitable
60 However, in SBCL (as in CMU CL or, for that matter, any compiler
61 which really understands Common Lisp types) a suitable default
62 does exist, in all cases, because the compiler understands the
63 concept of functions which never return (i.e. has return type NIL).
64 Thus, as a portable workaround, you can use a call to some
65 known-never-to-return function as the default. E.g.
67 (BAR (ERROR "missing :BAR argument")
68 :TYPE SOME-TYPE-TOO-HAIRY-TO-CONSTRUCT-AN-INSTANCE-OF))
70 (DECLAIM (FTYPE (FUNCTION () NIL) MISSING-ARG))
71 (DEFUN REQUIRED-ARG () ; workaround for SBCL non-ANSI slot init typing
72 (ERROR "missing required argument"))
74 (BAR (REQUIRED-ARG) :TYPE TRICKY-TYPE-OF-SOME-SORT)
75 (BLETCH (REQUIRED-ARG) :TYPE TRICKY-TYPE-OF-SOME-SORT)
76 (N-REFS-SO-FAR 0 :TYPE (INTEGER 0)))
77 Such code should compile without complaint and work correctly either
78 on SBCL or on any other completely compliant Common Lisp system.
80 b: &AUX argument in a boa-constructor without a default value means
81 "do not initilize this slot" and does not cause type error. But
82 an error may be signalled at read time and it would be good if
88 And as long as we're wishing, it would be awfully nice if INSPECT could
89 also report on closures, telling about the values of the bound variables.
91 Currently INSPECT and DESCRIBE do show the values, but showing the
92 names of the bindings would be even nicer.
95 The compiler assumes that any time a function of declared FTYPE
96 doesn't signal an error, its arguments were of the declared type.
97 E.g. compiling and loading
98 (DECLAIM (OPTIMIZE (SAFETY 3)))
99 (DEFUN FACTORIAL (X) (GAMMA (1+ X)))
101 (DECLAIM (FTYPE (FUNCTION (UNSIGNED-BYTE)) FACTORIAL))
103 (COND ((> (FACTORIAL X) 1.0E6)
104 (FORMAT T "too big~%"))
106 (FORMAT T "exactly ~S~%" (FACTORIAL X)))
108 (FORMAT T "approximately ~S~%" (FACTORIAL X)))))
111 will cause the INTEGERP case to be selected, giving bogus output a la
113 This violates the "declarations are assertions" principle.
114 According to the ANSI spec, in the section "System Class FUNCTION",
115 this is a case of "lying to the compiler", but the lying is done
116 by the code which calls FACTORIAL with non-UNSIGNED-BYTE arguments,
117 not by the unexpectedly general definition of FACTORIAL. In any case,
118 "declarations are assertions" means that lying to the compiler should
119 cause an error to be signalled, and should not cause a bogus
120 result to be returned. Thus, the compiler should not assume
121 that arbitrary functions check their argument types. (It might
122 make sense to add another flag (CHECKED?) to DEFKNOWN to
123 identify functions which *do* check their argument types.)
124 (Also, verify that the compiler handles declared function
125 return types as assertions.)
128 The definitions of SIGCONTEXT-FLOAT-REGISTER and
129 %SET-SIGCONTEXT-FLOAT-REGISTER in x86-vm.lisp say they're not
130 supported on FreeBSD because the floating point state is not saved,
131 but at least as of FreeBSD 4.0, the floating point state *is* saved,
132 so they could be supported after all. Very likely
133 SIGCONTEXT-FLOATING-POINT-MODES could now be supported, too.
136 Compiling and loading
137 (DEFUN FAIL (X) (THROW 'FAIL-TAG X))
139 then requesting a BACKTRACE at the debugger prompt gives no information
140 about where in the user program the problem occurred.
142 (this is apparently mostly fixed on the SPARC, PPC, and x86 architectures:
143 while giving the backtrace the non-x86 systems complains about "unknown
144 source location: using block start", but apart from that the
145 backtrace seems reasonable. On x86 this is masked by bug 353. See
146 tests/debug.impure.lisp for a test case)
149 Using the pretty-printer from the command prompt gives funny
150 results, apparently because the pretty-printer doesn't know
151 about user's command input, including the user's carriage return
152 that the user, and therefore the pretty-printer thinks that
153 the new output block should start indented 2 or more characters
154 rightward of the correct location.
157 As reported by Winton Davies on a CMU CL mailing list 2000-01-10,
158 and reported for SBCL by Martin Atzmueller 2000-10-20: (TRACE GETHASH)
159 crashes SBCL. In general tracing anything which is used in the
160 implementation of TRACE is likely to have the same problem.
163 ANSI says in one place that type declarations can be abbreviated even
164 when the type name is not a symbol, e.g.
165 (DECLAIM ((VECTOR T) *FOOVECTOR*))
166 SBCL doesn't support this. But ANSI says in another place that this
167 isn't allowed. So it's not clear this is a bug after all. (See the
168 e-mail on cmucl-help@cons.org on 2001-01-16 and 2001-01-17 from WHN
171 (Actually this has changed changed since, and types as above are
172 now supported. This may be a bug.)
175 RANDOM-INTEGER-EXTRA-BITS=10 may not be large enough for the RANDOM
176 RNG to be high quality near RANDOM-FIXNUM-MAX; it looks as though
177 the mean of the distribution can be systematically O(0.1%) wrong.
178 Just increasing R-I-E-B is probably not a good solution, since
179 it would decrease efficiency more than is probably necessary. Perhaps
180 using some sort of accept/reject method would be better.
183 Internally the compiler sometimes evaluates
184 (sb-kernel:type/= (specifier-type '*) (specifier-type t))
185 (I stumbled across this when I added an
186 (assert (not (eq type1 *wild-type*)))
187 in the NAMED :SIMPLE-= type method.) '* isn't really a type, and
188 in a type context should probably be translated to T, and so it's
189 probably wrong to ask whether it's equal to the T type and then (using
190 the EQ type comparison in the NAMED :SIMPLE-= type method) return NIL.
191 (I haven't tried to investigate this bug enough to guess whether
192 there might be any user-level symptoms.)
194 In fact, the type system is likely to depend on this inequality not
195 holding... * is not equivalent to T in many cases, such as
196 (VECTOR *) /= (VECTOR T).
199 In sbcl-0.6.11.41 (and in all earlier SBCL, and in CMU
200 CL), out-of-line structure slot setters are horribly inefficient
201 whenever the type of the slot is declared, because out-of-line
202 structure slot setters are implemented as closures to save space,
203 so the compiler doesn't compile the type test into code, but
204 instead just saves the type in a lexical closure and interprets it
206 To exercise the problem, compile and load
207 (cl:in-package :cl-user)
209 (bar (error "missing") :type bar))
212 (loop (setf (foo-bar *foo*) x)))
214 (defvar *bar* (make-bar))
215 (defvar *foo* (make-foo :bar *bar*))
216 (defvar *setf-foo-bar* #'(setf foo-bar))
218 (loop (funcall *setf-foo-bar* x *foo*)))
219 then run (WASTREL1 *BAR*) or (WASTREL2 *BAR*), hit Ctrl-C, and
220 use BACKTRACE, to see it's spending all essentially all its time
221 in %TYPEP and VALUES-SPECIFIER-TYPE and so forth.
222 One possible solution would be simply to give up on
223 representing structure slot accessors as functions, and represent
224 them as macroexpansions instead. This can be inconvenient for users,
225 but it's not clear that it's worse than trying to help by expanding
226 into a horribly inefficient implementation.
227 As a workaround for the problem, #'(SETF FOO) expressions
228 can be replaced with (EFFICIENT-SETF-FUNCTION FOO), where
229 (defmacro efficient-setf-function (place-function-name)
230 (or #+sbcl (and (sb-int:info :function :accessor-for place-function-name)
231 ;; a workaround for the problem, encouraging the
232 ;; inline expansion of the structure accessor, so
233 ;; that the compiler can optimize its type test
234 (let ((new-value (gensym "NEW-VALUE-"))
235 (structure-value (gensym "STRUCTURE-VALUE-")))
236 `(lambda (,new-value ,structure-value)
237 (setf (,place-function-name ,structure-value)
239 ;; no problem, can just use the ordinary expansion
240 `(function (setf ,place-function-name))))
243 There's apparently a bug in CEILING optimization which caused
244 Douglas Crosher to patch the CMU CL version. Martin Atzmueller
245 applied the patches to SBCL and they didn't seem to cause problems
246 (as reported sbcl-devel 2001-05-04). However, since the patches
247 modify nontrivial code which was apparently written incorrectly
248 the first time around, until regression tests are written I'm not
249 comfortable merging the patches in the CVS version of SBCL.
252 (TIME (ROOM T)) reports more than 200 Mbytes consed even for
253 a clean, just-started SBCL system. And it seems to be right:
254 (ROOM T) can bring a small computer to its knees for a *long*
255 time trying to GC afterwards. Surely there's some more economical
256 way to implement (ROOM T).
258 Daniel Barlow doesn't know what fixed this, but observes that it
259 doesn't seem to be the case in 0.8.7.3 any more. Instead, (ROOM T)
260 in a fresh SBCL causes
262 debugger invoked on a SB-INT:BUG in thread 5911:
263 failed AVER: "(SAP= CURRENT END)"
265 unless a GC has happened beforehand.
268 When the compiler inline expands functions, it may be that different
269 kinds of return values are generated from different code branches.
270 E.g. an inline expansion of POSITION generates integer results
271 from one branch, and NIL results from another. When that inline
272 expansion is used in a context where only one of those results
275 (aref *a1* (position x *a2*)))
276 and the compiler can't prove that the unacceptable branch is
277 never taken, then bogus type mismatch warnings can be generated.
278 If you need to suppress the type mismatch warnings, you can
279 suppress the inline expansion,
281 #+sbcl (declare (notinline position)) ; to suppress bug 117 bogowarnings
282 (aref *a1* (position x *a2*)))
283 or, sometimes, suppress them by declaring the result to be of an
286 (aref *a1* (the integer (position x *a2*))))
288 This is not a new compiler problem in 0.7.0, but the new compiler
289 transforms for FIND, POSITION, FIND-IF, and POSITION-IF make it
290 more conspicuous. If you don't need performance from these functions,
291 and the bogus warnings are a nuisance for you, you can return to
292 your pre-0.7.0 state of grace with
293 #+sbcl (declaim (notinline find position find-if position-if)) ; bug 117..
298 As of version 0.pre7.14, SBCL's implementation of MACROLET makes
299 the entire lexical environment at the point of MACROLET available
300 in the bodies of the macroexpander functions. In particular, it
301 allows the function bodies (which run at compile time) to try to
302 access lexical variables (which are only defined at runtime).
303 It doesn't even issue a warning, which is bad.
305 The SBCL behavior arguably conforms to the ANSI spec (since the
306 spec says that the behavior is undefined, ergo anything conforms).
307 However, it would be better to issue a compile-time error.
308 Unfortunately I (WHN) don't see any simple way to detect this
309 condition in order to issue such an error, so for the meantime
310 SBCL just does this weird broken "conforming" thing.
312 The ANSI standard says, in the definition of the special operator
314 The macro-expansion functions defined by MACROLET are defined
315 in the lexical environment in which the MACROLET form appears.
316 Declarations and MACROLET and SYMBOL-MACROLET definitions affect
317 the local macro definitions in a MACROLET, but the consequences
318 are undefined if the local macro definitions reference any
319 local variable or function bindings that are visible in that
321 Then it seems to contradict itself by giving the example
323 (macrolet ((fudge (z)
324 ;The parameters x and flag are not accessible
325 ; at this point; a reference to flag would be to
326 ; the global variable of that name.
327 ` (if flag (* ,z ,z) ,z)))
328 ;The parameters x and flag are accessible here.
332 The comment "a reference to flag would be to the global variable
333 of the same name" sounds like good behavior for the system to have.
334 but actual specification quoted above says that the actual behavior
337 (Since 0.7.8.23 macroexpanders are defined in a restricted version
338 of the lexical environment, containing no lexical variables and
339 functions, which seems to conform to ANSI and CLtL2, but signalling
340 a STYLE-WARNING for references to variables similar to locals might
344 Ideally, uninterning a symbol would allow it, and its associated
345 FDEFINITION and PROCLAIM data, to be reclaimed by the GC. However,
346 at least as of sbcl-0.7.0, this isn't the case. Information about
347 FDEFINITIONs and PROCLAIMed properties is stored in globaldb.lisp
348 essentially in ordinary (non-weak) hash tables keyed by symbols.
349 Thus, once a system has an entry in this system, it tends to live
350 forever, even when it is uninterned and all other references to it
354 (reported by Jesse Bouwman 2001-10-24 through the unfortunately
355 prominent SourceForge web/db bug tracking system, which is
356 unfortunately not a reliable way to get a timely response from
357 the SBCL maintainers)
358 In the course of trying to build a test case for an
359 application error, I encountered this behavior:
360 If you start up sbcl, and then lay on CTRL-C for a
361 minute or two, the lisp process will eventually say:
362 %PRIMITIVE HALT called; the party is over.
363 and throw you into the monitor. If I start up lisp,
364 attach to the process with strace, and then do the same
365 (abusive) thing, I get instead:
366 access failure in heap page not marked as write-protected
367 and the monitor again. I don't know enough to have the
368 faintest idea of what is going on here.
369 This is with sbcl 6.12, uname -a reports:
370 Linux prep 2.2.19 #4 SMP Tue Apr 24 13:59:52 CDT 2001 i686 unknown
371 I (WHN) have verified that the same thing occurs on sbcl-0.pre7.141
372 under OpenBSD 2.9 on my X86 laptop. Do be patient when you try it:
373 it took more than two minutes (but less than five) for me.
377 ANSI allows types `(COMPLEX ,FOO) to use very hairy values for
378 FOO, e.g. (COMPLEX (AND REAL (SATISFIES ODDP))). The old CMU CL
379 COMPLEX implementation didn't deal with this, and hasn't been
380 upgraded to do so. (This doesn't seem to be a high priority
381 conformance problem, since seems hard to construct useful code
384 [ partially fixed by CSR in 0.8.17.17 because of a PFD ansi-tests
385 report that (COMPLEX RATIO) was failing; still failing on types of
386 the form (AND NUMBER (SATISFIES REALP) (SATISFIES ZEROP)). ]
388 b. (fixed in 0.8.3.43)
391 Floating point errors are reported poorly. E.g. on x86 OpenBSD
394 debugger invoked on condition of type SB-KERNEL:FLOATING-POINT-EXCEPTION:
395 An arithmetic error SB-KERNEL:FLOATING-POINT-EXCEPTION was signalled.
396 No traps are enabled? How can this be?
397 It should be possible to be much more specific (overflow, division
398 by zero, etc.) and of course the "How can this be?" should be fixable.
400 See also bugs #45.c and #183
403 (reported by Robert E. Brown 2002-04-16)
404 When a function is called with too few arguments, causing the
405 debugger to be entered, the uninitialized slots in the bad call frame
406 seem to cause GCish problems, being interpreted as tagged data even
407 though they're not. In particular, executing ROOM in the
408 debugger at that point causes AVER failures:
411 * (lisp-implementation-version)
417 failed AVER: "(SAP= CURRENT END)"
418 (Christophe Rhodes reports that this doesn't occur on the SPARC, which
419 isn't too surprising since there are many differences in stack
420 implementation and GC conservatism between the X86 and other ports.)
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 This example could be solved with clever enough constraint
486 propagation or with SSA, but consider
491 The careful type of X is {2k} :-(. Is it really important to be
492 able to work with unions of many intervals?
494 191: "Miscellaneous PCL deficiencies"
495 (reported by Alexey Dejneka sbcl-devel 2002-08-04)
496 a. DEFCLASS does not inform the compiler about generated
497 functions. Compiling a file with
501 (WITH-SLOTS (A-CLASS-X) A
503 results in a STYLE-WARNING:
505 SB-SLOT-ACCESSOR-NAME::|COMMON-LISP-USER A-CLASS-X slot READER|
507 APD's fix for this was checked in to sbcl-0.7.6.20, but Pierre
508 Mai points out that the declamation of functions is in fact
509 incorrect in some cases (most notably for structure
510 classes). This means that at present erroneous attempts to use
511 WITH-SLOTS and the like on classes with metaclass STRUCTURE-CLASS
512 won't get the corresponding STYLE-WARNING.
514 [much later, in 2006-08] in fact it's no longer erroneous to use
515 WITH-SLOTS on structure-classes. However, including :METACLASS
516 STRUCTURE-CLASS in the class definition gives a whole bunch of
517 function redefinition warnings, so we're still not good to close
520 c. (fixed in 0.8.4.23)
522 201: "Incautious type inference from compound types"
523 a. (reported by APD sbcl-devel 2002-09-17)
525 (LET ((Y (CAR (THE (CONS INTEGER *) X))))
527 (FORMAT NIL "~S IS ~S, Y = ~S"
534 (FOO ' (1 . 2)) => "NIL IS INTEGER, Y = 1"
538 (declare (type (array * (4 4)) x))
540 (setq x (make-array '(4 4)))
541 (adjust-array y '(3 5))
542 (= (array-dimension y 0) (eval `(array-dimension ,y 0)))))
544 * (foo (make-array '(4 4) :adjustable t))
547 205: "environment issues in cross compiler"
548 (These bugs have no impact on user code, but should be fixed or
550 a. Macroexpanders introduced with MACROLET are defined in the null
552 b. The body of (EVAL-WHEN (:COMPILE-TOPLEVEL) ...) is evaluated in
553 the null lexical environment.
554 c. The cross-compiler cannot inline functions defined in a non-null
557 206: ":SB-FLUID feature broken"
558 (reported by Antonio Martinez-Shotton sbcl-devel 2002-10-07)
559 Enabling :SB-FLUID in the target-features list in sbcl-0.7.8 breaks
562 207: "poorly distributed SXHASH results for compound data"
563 SBCL's SXHASH could probably try a little harder. ANSI: "the
564 intent is that an implementation should make a good-faith
565 effort to produce hash-codes that are well distributed
566 within the range of non-negative fixnums". But
567 (let ((hits (make-hash-table)))
570 (let* ((ij (cons i j))
571 (newlist (push ij (gethash (sxhash ij) hits))))
573 (format t "~&collision: ~S~%" newlist))))))
574 reports lots of collisions in sbcl-0.7.8. A stronger MIX function
575 would be an obvious way of fix. Maybe it would be acceptably efficient
576 to redo MIX using a lookup into a 256-entry s-box containing
577 29-bit pseudorandom numbers?
579 211: "keywords processing"
580 a. :ALLOW-OTHER-KEYS T should allow a function to receive an odd
581 number of keyword arguments.
583 212: "Sequence functions and circular arguments"
584 COERCE, MERGE and CONCATENATE go into an infinite loop when given
585 circular arguments; it would be good for the user if they could be
586 given an error instead (ANSI 17.1.1 allows this behaviour on the part
587 of the implementation, as conforming code cannot give non-proper
588 sequences to these functions. MAP also has this problem (and
589 solution), though arguably the convenience of being able to do
590 (MAP 'LIST '+ FOO '#1=(1 . #1#))
591 might be classed as more important (though signalling an error when
592 all of the arguments are circular is probably desireable).
594 213: "Sequence functions and type checking"
595 b. MAP, when given a type argument that is SUBTYPEP LIST, does not
596 check that it will return a sequence of the given type. Fixing
597 it along the same lines as the others (cf. work done around
598 sbcl-0.7.8.45) is possible, but doing so efficiently didn't look
599 entirely straightforward.
600 c. All of these functions will silently accept a type of the form
602 whether or not the return value is of this type. This is
603 probably permitted by ANSI (see "Exceptional Situations" under
604 ANSI MAKE-SEQUENCE), but the DERIVE-TYPE mechanism does not
605 know about this escape clause, so code of the form
606 (INTEGERP (CAR (MAKE-SEQUENCE '(CONS INTEGER *) 2)))
607 can erroneously return T.
609 215: ":TEST-NOT handling by functions"
610 a. FIND and POSITION currently signal errors when given non-NIL for
611 both their :TEST and (deprecated) :TEST-NOT arguments, but by
612 ANSI 17.2 "the consequences are unspecified", which by ANSI 1.4.2
613 means that the effect is "unpredictable but harmless". It's not
614 clear what that actually means; it may preclude conforming
615 implementations from signalling errors.
616 b. COUNT, REMOVE and the like give priority to a :TEST-NOT argument
617 when conflict occurs. As a quality of implementation issue, it
618 might be preferable to treat :TEST and :TEST-NOT as being in some
619 sense the same &KEY, and effectively take the first test function in
621 c. Again, a quality of implementation issue: it would be good to issue a
622 STYLE-WARNING at compile-time for calls with :TEST-NOT, and a
623 WARNING for calls with both :TEST and :TEST-NOT; possibly this
624 latter should be WARNed about at execute-time too.
626 216: "debugger confused by frames with invalid number of arguments"
627 In sbcl-0.7.8.51, executing e.g. (VECTOR-PUSH-EXTEND T), BACKTRACE, Q
628 leaves the system confused, enough so that (QUIT) no longer works.
629 It's as though the process of working with the uninitialized slot in
630 the bad VECTOR-PUSH-EXTEND frame causes GC problems, though that may
631 not be the actual problem. (CMU CL 18c doesn't have problems with this.)
633 This is probably the same bug as 162
635 235: "type system and inline expansion"
637 (declaim (ftype (function (cons) number) acc))
638 (declaim (inline acc))
640 (the number (car c)))
643 (values (locally (declare (optimize (safety 0)))
645 (locally (declare (optimize (safety 3)))
648 (foo '(nil) '(t)) => NIL, T.
650 As of 0.9.15.41 this seems to be due to ACC being inlined only once
651 inside FOO, which results in the second call reusing the FUNCTIONAL
652 resulting from the first -- which doesn't check the type.
654 237: "Environment arguments to type functions"
655 a. Functions SUBTYPEP, TYPEP, UPGRADED-ARRAY-ELEMENT-TYPE, and
656 UPGRADED-COMPLEX-PART-TYPE now have an optional environment
657 argument, but they ignore it completely. This is almost
658 certainly not correct.
659 b. Also, the compiler's optimizers for TYPEP have not been informed
660 about the new argument; consequently, they will not transform
661 calls of the form (TYPEP 1 'INTEGER NIL), even though this is
662 just as optimizeable as (TYPEP 1 'INTEGER).
664 238: "REPL compiler overenthusiasm for CLOS code"
666 * (defclass foo () ())
667 * (defmethod bar ((x foo) (foo foo)) (call-next-method))
668 causes approximately 100 lines of code deletion notes. Some
669 discussion on this issue happened under the title 'Three "interesting"
670 bugs in PCL', resulting in a fix for this oververbosity from the
671 compiler proper; however, the problem persists in the interactor
672 because the notion of original source is not preserved: for the
673 compiler, the original source of the above expression is (DEFMETHOD
674 BAR ((X FOO) (FOO FOO)) (CALL-NEXT-METHOD)), while by the time the
675 compiler gets its hands on the code needing compilation from the REPL,
676 it has been macroexpanded several times.
678 A symptom of the same underlying problem, reported by Tony Martinez:
680 (with-input-from-string (*query-io* " no")
682 (simple-type-error () 'error))
684 ; (SB-KERNEL:FLOAT-WAIT)
686 ; note: deleting unreachable code
687 ; compilation unit finished
690 242: "WRITE-SEQUENCE suboptimality"
691 (observed from clx performance)
692 In sbcl-0.7.13, WRITE-SEQUENCE of a sequence of type
693 (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) on a stream with element-type
694 (UNSIGNED-BYTE 8) will write to the stream one byte at a time,
695 rather than writing the sequence in one go, leading to severe
696 performance degradation.
697 As of sbcl-0.9.0.36, this is solved for fd-streams, so is less of a
698 problem in practice. (Fully fixing this would require adding a
699 ansi-stream-n-bout slot and associated methods to write a byte
700 sequence to ansi-stream, similar to the existing ansi-stream-sout
703 243: "STYLE-WARNING overenthusiasm for unused variables"
704 (observed from clx compilation)
705 In sbcl-0.7.14, in the presence of the macros
706 (DEFMACRO FOO (X) `(BAR ,X))
707 (DEFMACRO BAR (X) (DECLARE (IGNORABLE X)) 'NIL)
708 somewhat surprising style warnings are emitted for
709 (COMPILE NIL '(LAMBDA (Y) (FOO Y))):
711 ; (LAMBDA (Y) (FOO Y))
713 ; caught STYLE-WARNING:
714 ; The variable Y is defined but never used.
716 245: bugs in disassembler
717 b. On X86 operand size prefix is not recognized.
720 (defun foo (&key (a :x))
724 does not cause a warning. (BTW: old SBCL issued a warning, but for a
725 function, which was never called!)
728 Compiler does not emit warnings for
730 a. (lambda () (svref (make-array 8 :adjustable t) 1))
732 b. (fixed at some point before 1.0.4.10)
735 (declare (optimize (debug 0)))
736 (declare (type vector x))
737 (list (fill-pointer x)
741 Complex array type does not have corresponding type specifier.
743 This is a problem because the compiler emits optimization notes when
744 you use a non-simple array, and without a type specifier for hairy
745 array types, there's no good way to tell it you're doing it
746 intentionally so that it should shut up and just compile the code.
748 Another problem is confusing error message "asserted type ARRAY
749 conflicts with derived type (VALUES SIMPLE-VECTOR &OPTIONAL)" during
750 compiling (LAMBDA (V) (VALUES (SVREF V 0) (VECTOR-POP V))).
752 The last problem is that when type assertions are converted to type
753 checks, types are represented with type specifiers, so we could lose
754 complex attribute. (Now this is probably not important, because
755 currently checks for complex arrays seem to be performed by
759 (compile nil '(lambda () (aref (make-array 0) 0))) compiles without
760 warning. Analogous cases with the index and length being equal and
761 greater than 0 are warned for; the problem here seems to be that the
762 type required for an array reference of this type is (INTEGER 0 (0))
763 which is canonicalized to NIL.
768 (t1 (specifier-type s)))
769 (eval `(defstruct ,s))
770 (type= t1 (specifier-type s)))
775 b. The same for CSUBTYPEP.
777 262: "yet another bug in inline expansion of local functions"
778 During inline expansion of a local function Python can try to
779 reference optimized away objects (functions, variables, CTRANs from
780 tags and blocks), which later may lead to problems. Some of the
781 cases are worked around by forbidding expansion in such cases, but
782 the better way would be to reimplement inline expansion by copying
786 David Lichteblau provided (sbcl-devel 2003-06-01) a patch to fix
787 behaviour of streams with element-type (SIGNED-BYTE 8). The patch
788 looks reasonable, if not obviously correct; however, it caused the
789 PPC/Linux port to segfault during warm-init while loading
790 src/pcl/std-class.fasl. A workaround patch was made, but it would
791 be nice to understand why the first patch caused problems, and to
792 fix the cause if possible.
794 268: "wrong free declaration scope"
795 The following code must signal type error:
797 (locally (declare (optimize (safety 3)))
798 (flet ((foo (x &optional (y (car x)))
799 (declare (optimize (safety 0)))
801 (funcall (eval #'foo) 1)))
804 In the following function constraint propagator optimizes nothing:
807 (declare (integer x))
808 (declare (optimize speed))
816 Compilation of the following two forms causes "X is unbound" error:
818 (symbol-macrolet ((x pi))
819 (macrolet ((foo (y) (+ x y)))
820 (declaim (inline bar))
826 (See (COERCE (CDR X) 'FUNCTION) in IR1-CONVERT-INLINE-LAMBDA.)
829 CLHS says that type declaration of a symbol macro should not affect
830 its expansion, but in SBCL it does. (If you like magic and want to
831 fix it, don't forget to change all uses of MACROEXPAND to
835 The following code (taken from CLOCC) takes a lot of time to compile:
838 (declare (type (integer 0 #.large-constant) n))
841 (fixed in 0.8.2.51, but a test case would be good)
844 b. The same as in a., but using MULTIPLE-VALUE-SETQ instead of SETQ.
846 (defmethod faa ((*faa* double-float))
847 (set '*faa* (when (< *faa* 0) (- *faa*)))
849 (faa 1d0) => type error
851 279: type propagation error -- correctly inferred type goes astray?
852 In sbcl-0.8.3 and sbcl-0.8.1.47, the warning
853 The binding of ABS-FOO is a (VALUES (INTEGER 0 0)
854 &OPTIONAL), not a (INTEGER 1 536870911)
855 is emitted when compiling this file:
856 (declaim (ftype (function ((integer 0 #.most-positive-fixnum))
857 (integer #.most-negative-fixnum 0))
862 (let* (;; Uncomment this for a type mismatch warning indicating
863 ;; that the type of (FOO X) is correctly understood.
864 #+nil (fs-foo (float-sign (foo x)))
865 ;; Uncomment this for a type mismatch warning
866 ;; indicating that the type of (ABS (FOO X)) is
867 ;; correctly understood.
868 #+nil (fs-abs-foo (float-sign (abs (foo x))))
869 ;; something wrong with this one though
870 (abs-foo (abs (foo x))))
871 (declare (type (integer 1 100) abs-foo))
876 283: Thread safety: libc functions
877 There are places that we call unsafe-for-threading libc functions
878 that we should find alternatives for, or put locks around. Known or
879 strongly suspected problems, as of 1.0.3.13: please update this
880 bug instead of creating new ones
882 284: Thread safety: special variables
883 There are lots of special variables in SBCL, and I feel sure that at
884 least some of them are indicative of potentially thread-unsafe
885 parts of the system. See doc/internals/notes/threading-specials
887 286: "recursive known functions"
888 Self-call recognition conflicts with known function
889 recognition. Currently cross compiler and target COMPILE do not
890 recognize recursion, and in target compiler it can be disabled. We
891 can always disable it for known functions with RECURSIVE attribute,
892 but there remains a possibility of a function with a
893 (tail)-recursive simplification pass and transforms/VOPs for base
896 288: fundamental cross-compilation issues (from old UGLINESS file)
897 Using host floating point numbers to represent target floating point
898 numbers, or host characters to represent target characters, is
899 theoretically shaky. (The characters are OK as long as the characters
900 are in the ANSI-guaranteed character set, though, so they aren't a
901 real problem as long as the sources don't need anything but that;
902 the floats are a real problem.)
904 289: "type checking and source-transforms"
906 (block nil (let () (funcall #'+ (eval 'nil) (eval '1) (return :good))))
909 Our policy is to check argument types at the moment of a call. It
910 disagrees with ANSI, which says that type assertions are put
911 immediately onto argument expressions, but is easier to implement in
912 IR1 and is more compatible to type inference, inline expansion,
913 etc. IR1-transforms automatically keep this policy, but source
914 transforms for associative functions (such as +), being applied
915 during IR1-convertion, do not. It may be tolerable for direct calls
916 (+ x y z), but for (FUNCALL #'+ x y z) it is non-conformant.
918 b. Another aspect of this problem is efficiency. [x y + z +]
919 requires less registers than [x y z + +]. This transformation is
920 currently performed with source transforms, but it would be good to
921 also perform it in IR1 optimization phase.
923 290: Alpha floating point and denormalized traps
924 In SBCL 0.8.3.6x on the alpha, we work around what appears to be a
925 hardware or kernel deficiency: the status of the enable/disable
926 denormalized-float traps bit seems to be ambiguous; by the time we
927 get to os_restore_fp_control after a trap, denormalized traps seem
928 to be enabled. Since we don't want a trap every time someone uses a
929 denormalized float, in general, we mask out that bit when we restore
930 the control word; however, this clobbers any change the user might
934 LOOP with non-constant arithmetic step clauses suffers from overzealous
935 type constraint: code of the form
936 (loop for d of-type double-float from 0d0 to 10d0 by x collect d)
937 compiles to a type restriction on X of (AND DOUBLE-FLOAT (REAL
938 (0))). However, an integral value of X should be legal, because
939 successive adds of integers to double-floats produces double-floats,
940 so none of the type restrictions in the code is violated.
942 300: (reported by Peter Graves) Function PEEK-CHAR checks PEEK-TYPE
943 argument type only after having read a character. This is caused
944 with EXPLICIT-CHECK attribute in DEFKNOWN. The similar problem
945 exists with =, /=, <, >, <=, >=. They were fixed, but it is probably
946 less error prone to have EXPLICIT-CHECK be a local declaration,
947 being put into the definition, instead of an attribute being kept in
948 a separate file; maybe also put it into SB-EXT?
950 301: ARRAY-SIMPLE-=-TYPE-METHOD breaks on corner cases which can arise
951 in NOTE-ASSUMED-TYPES
952 In sbcl-0.8.7.32, compiling the file
954 (declare (type integer x))
955 (declare (type (vector (or hash-table bit)) y))
958 (declare (type integer x))
959 (declare (type (simple-array base (2)) y))
962 failed AVER: "(NOT (AND (NOT EQUALP) CERTAINP))"
964 303: "nonlinear LVARs" (aka MISC.293)
966 (multiple-value-call #'list
968 (multiple-value-prog1
969 (eval '(values :a :b :c))
975 (throw 'bar (values 3 4)))))))))))
977 (BUU 1) returns garbage.
979 The problem is that both EVALs sequentially write to the same LVAR.
981 306: "Imprecise unions of array types"
983 a. fixed in SBCL 0.9.15.48
988 ,@(loop for x across sb-vm:*specialized-array-element-type-properties*
989 collect `(array ,(sb-vm:saetp-specifier x)))))
990 => NIL, T (when it should be T, T)
992 309: "Dubious values for implementation limits"
993 (reported by Bruno Haible sbcl-devel "Incorrect value of
994 multiple-values-limit" 2004-04-19)
995 (values-list (make-list 1000000)), on x86/linux, signals a stack
996 exhaustion condition, despite MULTIPLE-VALUES-LIMIT being
997 significantly larger than 1000000. There are probably similar
998 dubious values for CALL-ARGUMENTS-LIMIT (see cmucl-help/cmucl-imp
999 around the same time regarding a call to LIST on sparc with 1000
1000 arguments) and other implementation limit constants.
1002 314: "LOOP :INITIALLY clauses and scope of initializers"
1003 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
1004 test suite, originally by Thomas F. Burdick.
1005 ;; <http://www.lisp.org/HyperSpec/Body/sec_6-1-7-2.html>
1006 ;; According to the HyperSpec 6.1.2.1.4, in for-as-equals-then, var is
1007 ;; initialized to the result of evaluating form1. 6.1.7.2 says that
1008 ;; initially clauses are evaluated in the loop prologue, which precedes all
1009 ;; loop code except for the initial settings provided by with, for, or as.
1010 (loop :for x = 0 :then (1+ x)
1011 :for y = (1+ x) :then (ash y 1)
1012 :for z :across #(1 3 9 27 81 243)
1014 :initially (assert (zerop x)) :initially (assert (= 2 w))
1015 :until (>= w 100) :collect w)
1016 Expected: (2 6 15 38)
1019 318: "stack overflow in compiler warning with redefined class"
1020 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
1023 (setf (find-class 'foo) nil)
1024 (defstruct foo slot-1)
1025 This used to give a stack overflow from within the printer, which has
1026 been fixed as of 0.8.16.11. Current result:
1028 ; can't compile TYPEP of anonymous or undefined class:
1029 ; #<SB-KERNEL:STRUCTURE-CLASSOID FOO>
1031 debugger invoked on a TYPE-ERROR in thread 19973:
1032 The value NIL is not of type FUNCTION.
1034 CSR notes: it's not really clear what it should give: is (SETF FIND-CLASS)
1035 meant to be enough to delete structure classes from the system?
1037 319: "backquote with comma inside array"
1038 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
1040 (read-from-string "`#1A(1 2 ,(+ 2 2) 4)")
1042 #(1 2 ((SB-IMPL::|,|) + 2 2) 4)
1043 which probably isn't intentional.
1045 324: "STREAMs and :ELEMENT-TYPE with large bytesize"
1046 In theory, (open foo :element-type '(unsigned-byte <x>)) should work
1047 for all positive integral <x>. At present, it only works for <x> up
1048 to about 1024 (and similarly for signed-byte), so
1049 (open "/dev/zero" :element-type '(unsigned-byte 1025))
1050 gives an error in sbcl-0.8.10.
1052 325: "CLOSE :ABORT T on supeseding streams"
1053 Closing a stream opened with :IF-EXISTS :SUPERSEDE with :ABORT T leaves no
1054 file on disk, even if one existed before opening.
1056 The illegality of this is not crystal clear, as the ANSI dictionary
1057 entry for CLOSE says that when :ABORT is T superseded files are not
1058 superseded (ie. the original should be restored), whereas the OPEN
1059 entry says about :IF-EXISTS :SUPERSEDE "If possible, the
1060 implementation should not destroy the old file until the new stream
1061 is closed." -- implying that even though undesirable, early deletion
1062 is legal. Restoring the original would none the less be the polite
1065 326: "*PRINT-CIRCLE* crosstalk between streams"
1066 In sbcl-0.8.10.48 it's possible for *PRINT-CIRCLE* references to be
1067 mixed between streams when output operations are intermingled closely
1068 enough (as by doing output on S2 from within (PRINT-OBJECT X S1) in the
1069 test case below), so that e.g. the references #2# appears on a stream
1070 with no preceding #2= on that stream to define it (because the #2= was
1071 sent to another stream).
1072 (cl:in-package :cl-user)
1073 (defstruct foo index)
1074 (defparameter *foo* (make-foo :index 4))
1076 (defparameter *bar* (make-bar))
1077 (defparameter *tangle* (list *foo* *bar* *foo*))
1078 (defmethod print-object ((foo foo) stream)
1079 (let ((index (foo-index foo)))
1080 (format *trace-output*
1081 "~&-$- emitting FOO ~D, ambient *BAR*=~S~%"
1083 (format stream "[FOO ~D]" index))
1085 (let ((tsos (make-string-output-stream))
1086 (ssos (make-string-output-stream)))
1087 (let ((*print-circle* t)
1088 (*trace-output* tsos)
1089 (*standard-output* ssos))
1090 (prin1 *tangle* *standard-output*))
1091 (let ((string (get-output-stream-string ssos)))
1092 (unless (string= string "(#1=[FOO 4] #S(BAR) #1#)")
1093 ;; In sbcl-0.8.10.48 STRING was "(#1=[FOO 4] #2# #1#)".:-(
1094 (error "oops: ~S" string)))))
1095 It might be straightforward to fix this by turning the
1096 *CIRCULARITY-HASH-TABLE* and *CIRCULARITY-COUNTER* variables into
1097 per-stream slots, but (1) it would probably be sort of messy faking
1098 up the special variable binding semantics using UNWIND-PROTECT and
1099 (2) it might be sort of a pain to test that no other bugs had been
1102 328: "Profiling generic functions", transplanted from #241
1103 (from tonyms on #lisp IRC 2003-02-25)
1104 In sbcl-0.7.12.55, typing
1105 (defclass foo () ((bar :accessor foo-bar)))
1108 (defclass foo () ((bar :accessor foo-bar)))
1109 gives the error message
1110 "#:FOO-BAR already names an ordinary function or a macro."
1112 Problem: when a generic function is profiled, it appears as an ordinary
1113 function to PCL. (Remembering the uninterned accessor is OK, as the
1114 redefinition must be able to remove old accessors from their generic
1117 329: "Sequential class redefinition"
1118 reported by Bruno Haible:
1119 (defclass reactor () ((max-temp :initform 10000000)))
1120 (defvar *r1* (make-instance 'reactor))
1121 (defvar *r2* (make-instance 'reactor))
1122 (slot-value *r1* 'max-temp)
1123 (slot-value *r2* 'max-temp)
1124 (defclass reactor () ((uptime :initform 0)))
1125 (slot-value *r1* 'uptime)
1126 (defclass reactor () ((uptime :initform 0) (max-temp :initform 10000)))
1127 (slot-value *r1* 'max-temp) ; => 10000
1128 (slot-value *r2* 'max-temp) ; => 10000000 oops...
1131 The method effective when the wrapper is obsoleted can be saved
1132 in the wrapper, and then to update the instance just run through
1133 all the old wrappers in order from oldest to newest.
1135 332: "fasl stack inconsistency in structure redefinition"
1136 (reported by Tim Daly Jr sbcl-devel 2004-05-06)
1137 Even though structure redefinition is undefined by the standard, the
1138 following behaviour is suboptimal: running
1139 (defun stimulate-sbcl ()
1140 (let ((filename (format nil "/tmp/~A.lisp" (gensym))))
1141 ;;create a file which redefines a structure incompatibly
1142 (with-open-file (f filename :direction :output :if-exists :supersede)
1143 (print '(defstruct astruct foo) f)
1144 (print '(defstruct astruct foo bar) f))
1145 ;;compile and load the file, then invoke the continue restart on
1146 ;;the structure redefinition error
1147 (handler-bind ((error (lambda (c) (continue c))))
1148 (load (compile-file filename)))))
1150 and choosing the CONTINUE restart yields the message
1151 debugger invoked on a SB-INT:BUG in thread 27726:
1152 fasl stack not empty when it should be
1154 336: "slot-definitions must retain the generic functions of accessors"
1155 reported by Tony Martinez:
1156 (defclass foo () ((bar :reader foo-bar)))
1157 (defun foo-bar (x) x)
1158 (defclass foo () ((bar :reader get-bar))) ; => error, should work
1160 Note: just punting the accessor removal if the fdefinition
1161 is not a generic function is not enough:
1163 (defclass foo () ((bar :reader foo-bar)))
1164 (defvar *reader* #'foo-bar)
1165 (defun foo-bar (x) x)
1166 (defclass foo () ((bar :initform 'ok :reader get-bar)))
1167 (funcall *reader* (make-instance 'foo)) ; should be an error, since
1168 ; the method must be removed
1169 ; by the class redefinition
1171 Fixing this should also fix a subset of #328 -- update the
1172 description with a new test-case then.
1174 339: "DEFINE-METHOD-COMBINATION bugs"
1175 (reported by Bruno Haible via the clisp test suite)
1177 a. Syntax checking laxity (should produce errors):
1178 i. (define-method-combination foo :documentation :operator)
1179 ii. (define-method-combination foo :documentation nil)
1180 iii. (define-method-combination foo nil)
1181 iv. (define-method-combination foo nil nil
1182 (:arguments order &aux &key))
1183 v. (define-method-combination foo nil nil (:arguments &whole))
1184 vi. (define-method-combination foo nil nil (:generic-function))
1185 vii. (define-method-combination foo nil nil (:generic-function bar baz))
1186 viii. (define-method-combination foo nil nil (:generic-function (bar)))
1187 ix. (define-method-combination foo nil ((3)))
1188 x. (define-method-combination foo nil ((a)))
1190 b. define-method-combination arguments lambda list badness
1191 i. &aux args are currently unsupported;
1192 ii. default values of &optional and &key arguments are ignored;
1193 iii. supplied-p variables for &optional and &key arguments are not
1196 c. (fixed in sbcl-0.9.15.15)
1198 344: more (?) ROOM T problems (possibly part of bug 108)
1199 In sbcl-0.8.12.51, and off and on leading up to it, the
1200 SB!VM:MEMORY-USAGE operations in ROOM T caused
1201 unhandled condition (of type SB-INT:BUG):
1202 failed AVER: "(SAP= CURRENT END)"
1203 Several clever people have taken a shot at this without fixing
1204 it; this time around (before sbcl-0.8.13 release) I (WHN) just
1205 commented out the SB!VM:MEMORY-USAGE calls until someone figures
1206 out how to make them work reliably with the rest of the GC.
1208 (Note: there's at least one dubious thing in room.lisp: see the
1209 comment in VALID-OBJ)
1211 346: alpha backtrace
1212 In sbcl-0.8.13, all backtraces from errors caused by internal errors
1213 on the alpha seem to have a "bogus stack frame".
1215 349: PPRINT-INDENT rounding implementation decisions
1216 At present, pprint-indent (and indeed the whole pretty printer)
1217 more-or-less assumes that it's using a monospace font. That's
1218 probably not too silly an assumption, but one piece of information
1219 the current implementation loses is from requests to indent by a
1220 non-integral amount. As of sbcl-0.8.15.9, the system silently
1221 truncates the indentation to an integer at the point of request, but
1222 maybe the non-integral value should be propagated through the
1223 pprinter and only truncated at output? (So that indenting by 1/2
1224 then 3/2 would indent by two spaces, not one?)
1226 352: forward-referenced-class trouble
1227 reported by Bruno Haible on sbcl-devel
1229 (setf (class-name (find-class 'a)) 'b)
1233 Expected: an instance of c, with a slot named x
1234 Got: debugger invoked on a SIMPLE-ERROR in thread 78906:
1235 While computing the class precedence list of the class named C.
1236 The class named B is a forward referenced class.
1237 The class named B is a direct superclass of the class named C.
1239 [ Is this actually a bug? DEFCLASS only replaces an existing class
1240 when the class name is the proper name of that class, and in the
1241 above code the class found by (FIND-CLASS 'A) does not have a
1242 proper name. CSR, 2006-08-07 ]
1244 353: debugger suboptimalities on x86
1245 On x86 backtraces for undefined functions start with a bogus stack
1246 frame, and backtraces for throws to unknown catch tags with a "no
1247 debug information" frame. These are both due to CODE-COMPONENT-FROM-BITS
1248 (used on non-x86 platforms) being a more complete solution then what
1251 On x86/linux large portions of tests/debug.impure.lisp have been commented
1252 out as failures. The probable culprit for these problems is in x86-call-context
1253 (things work fine on x86/freebsd).
1255 More generally, the debugger internals suffer from excessive x86/non-x86
1256 conditionalization and OAOOMization: refactoring the common parts would
1259 354: XEPs in backtraces
1260 Under default compilation policy
1264 Has the XEP for TEST in the backtrace, not the TEST frame itself.
1265 (sparc and x86 at least)
1267 Since SBCL 0.8.20.1 this is hidden unless *SHOW-ENTRY-POINT-DETAILS*
1268 is true (instead there appear two TEST frames at least on ppc). The
1269 underlying cause seems to be that SB-C::TAIL-ANNOTATE will not merge
1270 the tail-call for the XEP, since Python has by that time proved that
1271 the function can never return; same happens if the function holds an
1272 unconditional call to ERROR.
1275 (reported by Bruno Haible)
1276 After the "layout depth conflict" error, the CLOS is left in a state where
1277 it's not possible to define new standard-class subclasses any more.
1279 (defclass prioritized-dispatcher ()
1280 ((dependents :type list :initform nil)))
1281 (defmethod sb-pcl:validate-superclass ((c1 sb-pcl:funcallable-standard-class)
1282 (c2 (eql (find-class 'prioritized-dispatcher))))
1284 (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
1286 (:metaclass sb-pcl:funcallable-standard-class))
1287 ;; ERROR, Quit the debugger with ABORT
1288 (defclass typechecking-reader-class (standard-class)
1290 Expected: #<STANDARD-CLASS TYPECHECKING-READER-CLASS>
1291 Got: ERROR "The assertion SB-PCL::WRAPPERS failed."
1293 [ This test case does not cause the error any more. However,
1294 similar problems can be observed with
1296 (defclass foo (standard-class) ()
1297 (:metaclass sb-mop:funcallable-standard-class))
1298 (sb-mop:finalize-inheritance (find-class 'foo))
1300 (defclass bar (standard-class) ())
1301 (make-instance 'bar)
1304 357: defstruct inheritance of initforms
1305 (reported by Bruno Haible)
1306 When defstruct and defclass (with :metaclass structure-class) are mixed,
1307 1. some slot initforms are ignored by the DEFSTRUCT generated constructor
1309 2. all slot initforms are ignored by MAKE-INSTANCE. (This can be arguably
1310 OK for initforms that were given in a DEFSTRUCT form, but for those
1311 given in a DEFCLASS form, I think it qualifies as a bug.)
1313 (defstruct structure02a
1317 (defclass structure02b (structure02a)
1318 ((slot4 :initform -44)
1321 (slot7 :initform (floor (* pi pi)))
1322 (slot8 :initform 88))
1323 (:metaclass structure-class))
1324 (defstruct (structure02c (:include structure02b (slot8 -88)))
1327 (slot11 (floor (exp 3))))
1329 (let ((a (make-structure02c)))
1330 (list (structure02c-slot4 a)
1331 (structure02c-slot5 a)
1332 (structure02c-slot6 a)
1333 (structure02c-slot7 a)))
1334 Expected: (-44 nil t 9)
1335 Got: (SB-PCL::..SLOT-UNBOUND.. SB-PCL::..SLOT-UNBOUND..
1336 SB-PCL::..SLOT-UNBOUND.. SB-PCL::..SLOT-UNBOUND..)
1338 (let ((b (make-instance 'structure02c)))
1339 (list (structure02c-slot2 b)
1340 (structure02c-slot3 b)
1341 (structure02c-slot4 b)
1342 (structure02c-slot6 b)
1343 (structure02c-slot7 b)
1344 (structure02c-slot8 b)
1345 (structure02c-slot10 b)
1346 (structure02c-slot11 b)))
1347 Expected: (t 3 -44 t 9 -88 t 20)
1348 Got: (0 0 0 0 0 0 0 0)
1350 359: wrong default value for ensure-generic-function's :generic-function-class argument
1351 (reported by Bruno Haible)
1352 ANSI CL is silent on this, but the MOP's specification of ENSURE-GENERIC-FUNCTION says:
1353 "The remaining arguments are the complete set of keyword arguments
1354 received by ENSURE-GENERIC-FUNCTION."
1355 and the spec of ENSURE-GENERIC-FUNCTION-USING-CLASS:
1356 ":GENERIC-FUNCTION-CLASS - a class metaobject or a class name. If it is not
1357 supplied, it defaults to the class named STANDARD-GENERIC-FUNCTION."
1358 This is not the case in SBCL. Test case:
1359 (defclass my-generic-function (standard-generic-function)
1361 (:metaclass sb-pcl:funcallable-standard-class))
1362 (setf (fdefinition 'foo1)
1363 (make-instance 'my-generic-function :name 'foo1))
1364 (ensure-generic-function 'foo1
1365 :generic-function-class (find-class 'standard-generic-function))
1367 ; => #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
1368 (setf (fdefinition 'foo2)
1369 (make-instance 'my-generic-function :name 'foo2))
1370 (ensure-generic-function 'foo2)
1372 Expected: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
1373 Got: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS MY-GENERIC-FUNCTION>
1375 362: missing error when a slot-definition is created without a name
1376 (reported by Bruno Haible)
1377 The MOP says about slot-definition initialization:
1378 "The :NAME argument is a slot name. An ERROR is SIGNALled if this argument
1379 is not a symbol which can be used as a variable name. An ERROR is SIGNALled
1380 if this argument is not supplied."
1382 (make-instance (find-class 'sb-pcl:standard-direct-slot-definition))
1384 Got: #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION NIL>
1386 363: missing error when a slot-definition is created with a wrong documentation object
1387 (reported by Bruno Haible)
1388 The MOP says about slot-definition initialization:
1389 "The :DOCUMENTATION argument is a STRING or NIL. An ERROR is SIGNALled
1390 if it is not. This argument default to NIL during initialization."
1392 (make-instance (find-class 'sb-pcl:standard-direct-slot-definition)
1394 :documentation 'not-a-string)
1396 Got: #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION FOO>
1398 369: unlike-an-intersection behavior of VALUES-TYPE-INTERSECTION
1399 In sbcl-0.8.18.2, the identity $(x \cap y \cap y)=(x \cap y)$
1400 does not hold for VALUES-TYPE-INTERSECTION, even for types which
1401 can be intersected exactly, so that ASSERTs fail in this test case:
1402 (in-package :cl-user)
1403 (let ((types (mapcar #'sb-c::values-specifier-type
1404 '((values (vector package) &optional)
1405 (values (vector package) &rest t)
1406 (values (vector hash-table) &rest t)
1407 (values (vector hash-table) &optional)
1408 (values t &optional)
1410 (values nil &optional)
1411 (values nil &rest t)
1412 (values sequence &optional)
1413 (values sequence &rest t)
1414 (values list &optional)
1415 (values list &rest t)))))
1418 (let ((i (sb-c::values-type-intersection x y)))
1419 (assert (sb-c::type= i (sb-c::values-type-intersection i x)))
1420 (assert (sb-c::type= i (sb-c::values-type-intersection i y)))))))
1422 370: reader misbehaviour on large-exponent floats
1423 (read-from-string "1.0s1000000000000000000000000000000000000000")
1424 causes the reader to attempt to create a very large bignum (which it
1425 will then attempt to coerce to a rational). While this isn't
1426 completely wrong, it is probably not ideal -- checking the floating
1427 point control word state and then returning the relevant float
1428 (most-positive-short-float or short-float-infinity) or signalling an
1429 error immediately would seem to make more sense.
1431 372: floating-point overflow not signalled on ppc/darwin
1432 The following assertions in float.pure.lisp fail on ppc/darwin
1433 (Mac OS X version 10.3.7):
1434 (assert (raises-error? (scale-float 1.0 most-positive-fixnum)
1435 floating-point-overflow))
1436 (assert (raises-error? (scale-float 1.0d0 (1+ most-positive-fixnum))
1437 floating-point-overflow)))
1438 as the SCALE-FLOAT just returns
1439 #.SB-EXT:SINGLE/DOUBLE-FLOAT-POSITIVE-INFINITY. These tests have been
1440 disabled on Darwin for now.
1442 377: Memory fault error reporting
1443 On those architectures where :C-STACK-IS-CONTROL-STACK is in
1444 *FEATURES*, we handle SIG_MEMORY_FAULT (SEGV or BUS) on an altstack,
1445 so we cannot handle the signal directly (as in interrupt_handle_now())
1446 in the case when the signal comes from some external agent (the user
1447 using kill(1), or a fault in some foreign code, for instance). As
1448 of sbcl-0.8.20.20, this is fixed by calling
1449 arrange_return_to_lisp_function() to a new error-signalling
1450 function, but as a result the error reporting is poor: we cannot
1451 even tell the user at which address the fault occurred. We should
1452 arrange such that arguments can be passed to the function called from
1453 arrange_return_to_lisp_function(), but this looked hard to do in
1454 general without suffering from memory leaks.
1456 379: TRACE :ENCAPSULATE NIL broken on ppc/darwin
1457 See commented-out test-case in debug.impure.lisp.
1459 380: Accessor redefinition fails because of old accessor name
1460 When redefining an accessor, SB-PCL::FIX-SLOT-ACCESSORS may try to
1461 find the generic function named by the old accessor name using
1462 ENSURE-GENERIC-FUNCTION and then remove the old accessor's method in
1463 the GF. If the old name does not name a function, or if the old name
1464 does not name a generic function, no attempt to find the GF or remove
1465 any methods is made.
1467 However, if an unrelated GF with an incompatible lambda list exists,
1468 the class redefinition will fail when SB-PCL::REMOVE-READER-METHOD
1469 tries to find and remove a method with an incompatible lambda list
1470 from the unrelated generic function.
1472 382: externalization unexpectedly changes array simplicity
1473 COMPILE-FILE and LOAD
1475 (let ((x #.(make-array 4 :fill-pointer 0)))
1476 (values (eval `(typep ',x 'simple-array))
1477 (typep x 'simple-array))))
1478 then (FOO) => T, NIL.
1480 Similar problems exist with SIMPLE-ARRAY-P, ARRAY-HEADER accessors
1481 and all array dimension functions.
1483 383: ASH'ing non-constant zeros
1486 (declare (type (integer -2 14) b))
1487 (declare (ignorable b))
1488 (ash (imagpart b) 57))
1489 on PPC (and other platforms, presumably) gives an error during the
1490 emission of FASH-ASH-LEFT/FIXNUM=>FIXNUM as the assembler attempts to
1491 stuff a too-large constant into the immediate field of a PPC
1492 instruction. Either the VOP should be fixed or the compiler should be
1493 taught how to transform this case away, paying particular attention
1494 to side-effects that might occur in the arguments to ASH.
1496 384: Compiler runaway on very large character types
1498 (compile nil '(lambda (x)
1499 (declare (type (member #\a 1) x))
1500 (the (member 1 nil) x)))
1502 The types apparently normalize into a very large type, and the compiler
1503 gets lost in REMOVE-DUPLICATES. Perhaps the latter should use
1504 a better algorithm (one based on hash tables, say) on very long lists
1505 when :TEST has its default value?
1509 (compile nil '(lambda (x) (the (not (eql #\a)) x)))
1511 (partially fixed in 0.9.3.1, but a better representation for these
1515 (format nil "~4,1F" 0.001) => "0.00" (should be " 0.0");
1516 (format nil "~4,1@F" 0.001) => "+.00" (should be "+0.0").
1518 386: SunOS/x86 stack exhaustion handling broken
1519 According to <http://alfa.s145.xrea.com/sbcl/solaris-x86.html>, the
1520 stack exhaustion checking (implemented with a write-protected guard
1521 page) does not work on SunOS/x86.
1524 (found by Dmitry Bogomolov)
1526 (defclass foo () ((x :type (unsigned-byte 8))))
1527 (defclass bar () ((x :type symbol)))
1528 (defclass baz (foo bar) ())
1532 SB-PCL::SPECIALIZER-APPLICABLE-USING-TYPE-P cannot handle the second argument
1535 [ Can't trigger this any more, as of 2006-08-07 ]
1538 (reported several times on sbcl-devel, by Rick Taube, Brian Rowe and
1541 ROUND-NUMERIC-BOUND assumes that float types always have a FORMAT
1542 specifying whether they're SINGLE or DOUBLE. This is true for types
1543 computed by the type system itself, but the compiler type derivation
1544 short-circuits this and constructs non-canonical types. A temporary
1545 fix was made to ROUND-NUMERIC-BOUND for the sbcl-0.9.6 release, but
1546 the right fix is to remove the abstraction violation in the
1547 compiler's type deriver.
1549 393: Wrong error from methodless generic function
1550 (DEFGENERIC FOO (X))
1552 gives NO-APPLICABLE-METHOD rather than an argument count error.
1554 395: Unicode and streams
1555 One of the remaining problems in SBCL's Unicode support is the lack
1556 of generality in certain streams.
1557 a. FILL-POINTER-STREAMs: SBCL refuses to write (e.g. using FORMAT)
1558 to streams made from strings that aren't character strings with
1560 (let ((v (make-array 5 :fill-pointer 0 :element-type 'standard-char)))
1563 should return a non-simple base string containing "foo" but
1566 (reported on sbcl-help by "tichy")
1568 396: block-compilation bug
1572 (when (funcall (eval #'(lambda (x) (eql x 2))) y)
1574 (incf x (incf y z))))))
1578 (bar 1) => 11, should be 4.
1581 The more interrupts arrive the less accurate SLEEP's timing gets.
1582 (time (sb-thread:terminate-thread
1583 (prog1 (sb-thread:make-thread (lambda ()
1590 398: GC-unsafe SB-ALIEN string deporting
1591 Translating a Lisp string to an alien string by taking a SAP to it
1592 as done by the :DEPORT-GEN methods for C-STRING and UTF8-STRING
1593 is not safe, since the Lisp string can move. For example the
1594 following code will fail quickly on both cheneygc and pre-0.9.8.19
1597 (setf (bytes-consed-between-gcs) 4096)
1598 (define-alien-routine "strcmp" int (s1 c-string) (s2 c-string))
1601 (let ((string "hello, world"))
1602 (assert (zerop (strcmp string string)))))
1604 (This will appear to work on post-0.9.8.19 GENCGC, since
1605 the GC no longer zeroes memory immediately after releasing
1606 it after a minor GC. Either enabling the READ_PROTECT_FREE_PAGES
1607 #define in gencgc.c or modifying the example so that a major
1608 GC will occasionally be triggered would unmask the bug.)
1610 On cheneygc the only solution would seem to be allocating some alien
1611 memory, copying the data over, and arranging that it's freed once we
1612 return. For GENCGC we could instead try to arrange that the string
1613 from which the SAP is taken is always pinned.
1615 For some more details see comments for (define-alien-type-method
1616 (c-string :deport-gen) ...) in host-c-call.lisp.
1618 402: "DECLAIM DECLARATION does not inform the PCL code-walker"
1619 reported by Vincent Arkesteijn:
1621 (declaim (declaration foo))
1622 (defgeneric bar (x))
1627 ==> WARNING: The declaration FOO is not understood by
1628 SB-PCL::SPLIT-DECLARATIONS.
1629 Please put FOO on one of the lists SB-PCL::*NON-VAR-DECLARATIONS*,
1630 SB-PCL::*VAR-DECLARATIONS-WITH-ARG*, or
1631 SB-PCL::*VAR-DECLARATIONS-WITHOUT-ARG*.
1632 (Assuming it is a variable declaration without argument).
1634 403: FORMAT/PPRINT-LOGICAL-BLOCK of CONDITIONs ignoring *PRINT-CIRCLE*
1637 (make-condition 'simple-error
1638 :format-control "ow... ~S"
1639 :format-arguments '(#1=(#1#))))
1640 (setf *print-circle* t *print-level* 4)
1641 (format nil "~@<~A~:@>" *c*)
1644 where I (WHN) believe the correct result is "ow... #1=(#1#)",
1645 like the result from (PRINC-TO-STRING *C*). The question of
1646 what the correct result is is complicated by the hairy text in
1647 the Hyperspec "22.3.5.2 Tilde Less-Than-Sign: Logical Block",
1648 Other than the difference in its argument, ~@<...~:> is
1649 exactly the same as ~<...~:> except that circularity detection
1650 is not applied if ~@<...~:> is encountered at top level in a
1652 But because the odd behavior happens even without the at-sign,
1653 (format nil "~<~A~:@>" (list *c*)) ; => "ow... (((#)))"
1654 and because something seemingly similar can happen even in
1655 PPRINT-LOGICAL-BLOCK invoked directly without FORMAT,
1656 (pprint-logical-block (*standard-output* '(some nonempty list))
1657 (format *standard-output* "~A" '#1=(#1#)))
1658 (which prints "(((#)))" to *STANDARD-OUTPUT*), I don't think
1659 that the 22.3.5.2 trickiness is fundamental to the problem.
1661 My guess is that the problem is related to the logic around the MODE
1662 argument to CHECK-FOR-CIRCULARITY, but I haven't reverse-engineered
1663 enough of the intended meaning of the different MODE values to be
1666 404: nonstandard DWIMness in LOOP with unportably-ordered clauses
1667 In sbcl-0.9.13, the code
1668 (loop with stack = (make-array 2 :fill-pointer 2 :initial-element t)
1669 for length = (length stack)
1670 while (plusp length)
1671 for element = (vector-pop stack)
1673 compiles without error or warning and returns (T T). Unfortunately,
1674 it is inconsistent with the ANSI definition of the LOOP macro,
1675 because it mixes up VARIABLE-CLAUSEs with MAIN-CLAUSEs. Furthermore,
1676 SBCL's interpretation of the intended meaning is only one possible,
1677 unportable interpretation of the noncompliant code; in CLISP 2.33.2,
1678 the code compiles with a warning
1679 LOOP: FOR clauses should occur before the loop's main body
1680 and then fails at runtime with
1681 VECTOR-POP: #() has length zero
1682 perhaps because CLISP has shuffled the clauses into an
1683 ANSI-compliant order before proceeding.
1685 405: a TYPE-ERROR in MERGE-LETS exercised at DEBUG 3
1686 In sbcl-0.9.16.21 on linux/86, compiling
1687 (declaim (optimize (debug 3)))
1690 (flet ((i (x) (frob x (foo-bar foo))))
1693 The value NIL is not of type SB-C::PHYSENV.
1696 406: functional has external references -- failed aver
1697 Given the following food in a single file
1698 (eval-when (:compile-toplevel :load-toplevel :execute)
1701 (foo #.(make-foo3)))
1702 as of 0.9.18.11 the file compiler breaks on it:
1703 failed AVER: "(NOT (FUNCTIONAL-HAS-EXTERNAL-REFERENCES-P CLAMBDA))"
1704 Defining the missing MAKE-LOAD-FORM method makes the error go away.
1706 407: misoptimization of loop, COERCE 'FLOAT, and HANDLER-CASE for bignums
1707 (reported by Ariel Badichi on sbcl-devel 2007-01-09)
1708 407a: In sbcl-1.0.1 on Linux x86,
1710 (loop for n from (expt 2 1024) do
1712 (coerce n 'single-float)
1713 (simple-type-error ()
1714 (format t "Got here.~%")
1715 (return-from foo)))))
1717 causes an infinite loop, where handling the error would be expected.
1718 407b: In sbcl-1.0.1 on Linux x86,
1720 (loop for n from (expt 2 1024) do
1722 (format t "~E~%" (coerce n 'single-float))
1723 (simple-type-error ()
1724 (format t "Got here.~%")
1725 (return-from bar)))))
1726 fails to compile, with
1727 Too large to be represented as a SINGLE-FLOAT: ...
1729 0: ((LABELS SB-BIGNUM::CHECK-EXPONENT) ...)
1730 1: ((LABELS SB-BIGNUM::FLOAT-FROM-BITS) ...)
1731 2: (SB-KERNEL:%SINGLE-FLOAT ...)
1732 3: (SB-C::BOUND-FUNC ...)
1733 4: (SB-C::%SINGLE-FLOAT-DERIVE-TYPE-AUX ...)
1735 408: SUBTYPEP confusion re. OR of SATISFIES of not-yet-defined predicate
1736 As reported by Levente M\'{e}sz\'{a}ros sbcl-devel 2006-02-20,
1737 (aver (equal (multiple-value-list
1738 (subtypep '(or (satisfies x) string)
1739 '(or (satisfies x) integer)))
1741 fails. Also, beneath that failure lurks another failure,
1742 (aver (equal (multiple-value-list
1744 '(or (satisfies x) integer)))
1746 Having looked at this for an hour or so in sbcl-1.0.2, and
1747 specifically having looked at the output from
1750 (y '(or (satisfies x) integer)))
1751 (trace sb-kernel::union-complex-subtypep-arg2
1752 sb-kernel::invoke-complex-subtypep-arg1-method
1753 sb-kernel::type-union
1754 sb-kernel::type-intersection
1757 my (WHN) impression is that the problem is that the semantics of TYPE=
1758 are wrong for what the UNION-COMPLEX-SUBTYPEP-ARG2 code is trying
1759 to use it for. The comments on the definition of TYPE= probably
1760 date back to CMU CL and seem to define it as a confusing thing:
1761 its primary value is something like "certainly equal," and its
1762 secondary value is something like "certain about that certainty."
1763 I'm left uncertain how to fix UNION-COMPLEX-SUBTYPEP-ARG2 without
1764 reducing its generality by removing the TYPE= cleverness. Possibly
1765 the tempting TYPE/= relative defined next to it might be a
1766 suitable replacement for the purpose. Probably, though, it would
1767 be best to start by reverse engineering exactly what TYPE= and
1768 TYPE/= do, and writing an explanation which is so clear that one
1769 can see immediately what it's supposed to mean in odd cases like
1770 (TYPE= '(SATISFIES X) 'INTEGER) when X isn't defined yet.
1772 409: MORE TYPE SYSTEM PROBLEMS
1773 Found while investigating an optimization failure for extended
1774 sequences. The extended sequence type implementation was altered to
1775 work around the problem, but the fundamental problem remains, to wit:
1776 (sb-kernel:type= (sb-kernel:specifier-type '(or float ratio))
1777 (sb-kernel:specifier-type 'single-float))
1778 returns NIL, NIL on sbcl-1.0.3.
1779 (probably related to bug #408)
1781 410: read circularities and type declarations
1782 Consider the definition
1783 (defstruct foo (a 0 :type (not symbol)))
1785 (setf *print-circle* t) ; just in case
1786 (read-from-string "#1=#s(foo :a #1#)")
1787 This gives a type error (#:G1 is not a (NOT SYMBOL)) because of the
1788 implementation of read circularity, using a symbol as a marker for
1789 the previously-referenced object.
1791 411: NAN issues on x86-64
1792 Test :NAN-COMPARISONS in float.pure.lisp fails on x86-64, and has been
1793 disabled on those platforms. Since x86 does not exhibit any problems
1794 the problem is probably with the new FP implementation.
1796 412: deletion of global variable references in safe code