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 Sometimes (SB-EXT:QUIT) fails with
89 Argh! maximum interrupt nesting depth (4096) exceeded, exiting
90 Process inferior-lisp exited abnormally with code 1
91 I haven't noticed a repeatable case of this yet.
94 And as long as we're wishing, it would be awfully nice if INSPECT could
95 also report on closures, telling about the values of the bound variables.
97 Currently INSPECT and DESCRIBE do show the values, but showing the
98 names of the bindings would be even nicer.
101 The compiler assumes that any time a function of declared FTYPE
102 doesn't signal an error, its arguments were of the declared type.
103 E.g. compiling and loading
104 (DECLAIM (OPTIMIZE (SAFETY 3)))
105 (DEFUN FACTORIAL (X) (GAMMA (1+ X)))
107 (DECLAIM (FTYPE (FUNCTION (UNSIGNED-BYTE)) FACTORIAL))
109 (COND ((> (FACTORIAL X) 1.0E6)
110 (FORMAT T "too big~%"))
112 (FORMAT T "exactly ~S~%" (FACTORIAL X)))
114 (FORMAT T "approximately ~S~%" (FACTORIAL X)))))
117 will cause the INTEGERP case to be selected, giving bogus output a la
119 This violates the "declarations are assertions" principle.
120 According to the ANSI spec, in the section "System Class FUNCTION",
121 this is a case of "lying to the compiler", but the lying is done
122 by the code which calls FACTORIAL with non-UNSIGNED-BYTE arguments,
123 not by the unexpectedly general definition of FACTORIAL. In any case,
124 "declarations are assertions" means that lying to the compiler should
125 cause an error to be signalled, and should not cause a bogus
126 result to be returned. Thus, the compiler should not assume
127 that arbitrary functions check their argument types. (It might
128 make sense to add another flag (CHECKED?) to DEFKNOWN to
129 identify functions which *do* check their argument types.)
130 (Also, verify that the compiler handles declared function
131 return types as assertions.)
134 The definitions of SIGCONTEXT-FLOAT-REGISTER and
135 %SET-SIGCONTEXT-FLOAT-REGISTER in x86-vm.lisp say they're not
136 supported on FreeBSD because the floating point state is not saved,
137 but at least as of FreeBSD 4.0, the floating point state *is* saved,
138 so they could be supported after all. Very likely
139 SIGCONTEXT-FLOATING-POINT-MODES could now be supported, too.
142 Compiling and loading
143 (DEFUN FAIL (X) (THROW 'FAIL-TAG X))
145 then requesting a BACKTRACE at the debugger prompt gives no information
146 about where in the user program the problem occurred.
148 (this is apparently mostly fixed on the SPARC, PPC, and x86 architectures:
149 while giving the backtrace the non-x86 systems complains about "unknown
150 source location: using block start", but apart from that the
151 backtrace seems reasonable. On x86 this is masked by bug 353. See
152 tests/debug.impure.lisp for a test case)
155 Using the pretty-printer from the command prompt gives funny
156 results, apparently because the pretty-printer doesn't know
157 about user's command input, including the user's carriage return
158 that the user, and therefore the pretty-printer thinks that
159 the new output block should start indented 2 or more characters
160 rightward of the correct location.
163 As reported by Winton Davies on a CMU CL mailing list 2000-01-10,
164 and reported for SBCL by Martin Atzmueller 2000-10-20: (TRACE GETHASH)
165 crashes SBCL. In general tracing anything which is used in the
166 implementation of TRACE is likely to have the same problem.
169 ANSI says in one place that type declarations can be abbreviated even
170 when the type name is not a symbol, e.g.
171 (DECLAIM ((VECTOR T) *FOOVECTOR*))
172 SBCL doesn't support this. But ANSI says in another place that this
173 isn't allowed. So it's not clear this is a bug after all. (See the
174 e-mail on cmucl-help@cons.org on 2001-01-16 and 2001-01-17 from WHN
178 RANDOM-INTEGER-EXTRA-BITS=10 may not be large enough for the RANDOM
179 RNG to be high quality near RANDOM-FIXNUM-MAX; it looks as though
180 the mean of the distribution can be systematically O(0.1%) wrong.
181 Just increasing R-I-E-B is probably not a good solution, since
182 it would decrease efficiency more than is probably necessary. Perhaps
183 using some sort of accept/reject method would be better.
186 Internally the compiler sometimes evaluates
187 (sb-kernel:type/= (specifier-type '*) (specifier-type t))
188 (I stumbled across this when I added an
189 (assert (not (eq type1 *wild-type*)))
190 in the NAMED :SIMPLE-= type method.) '* isn't really a type, and
191 in a type context should probably be translated to T, and so it's
192 probably wrong to ask whether it's equal to the T type and then (using
193 the EQ type comparison in the NAMED :SIMPLE-= type method) return NIL.
194 (I haven't tried to investigate this bug enough to guess whether
195 there might be any user-level symptoms.)
197 In fact, the type system is likely to depend on this inequality not
198 holding... * is not equivalent to T in many cases, such as
199 (VECTOR *) /= (VECTOR T).
202 In sbcl-0.6.11.41 (and in all earlier SBCL, and in CMU
203 CL), out-of-line structure slot setters are horribly inefficient
204 whenever the type of the slot is declared, because out-of-line
205 structure slot setters are implemented as closures to save space,
206 so the compiler doesn't compile the type test into code, but
207 instead just saves the type in a lexical closure and interprets it
209 To exercise the problem, compile and load
210 (cl:in-package :cl-user)
212 (bar (error "missing") :type bar))
215 (loop (setf (foo-bar *foo*) x)))
217 (defvar *bar* (make-bar))
218 (defvar *foo* (make-foo :bar *bar*))
219 (defvar *setf-foo-bar* #'(setf foo-bar))
221 (loop (funcall *setf-foo-bar* x *foo*)))
222 then run (WASTREL1 *BAR*) or (WASTREL2 *BAR*), hit Ctrl-C, and
223 use BACKTRACE, to see it's spending all essentially all its time
224 in %TYPEP and VALUES-SPECIFIER-TYPE and so forth.
225 One possible solution would be simply to give up on
226 representing structure slot accessors as functions, and represent
227 them as macroexpansions instead. This can be inconvenient for users,
228 but it's not clear that it's worse than trying to help by expanding
229 into a horribly inefficient implementation.
230 As a workaround for the problem, #'(SETF FOO) expressions
231 can be replaced with (EFFICIENT-SETF-FUNCTION FOO), where
232 (defmacro efficient-setf-function (place-function-name)
233 (or #+sbcl (and (sb-int:info :function :accessor-for place-function-name)
234 ;; a workaround for the problem, encouraging the
235 ;; inline expansion of the structure accessor, so
236 ;; that the compiler can optimize its type test
237 (let ((new-value (gensym "NEW-VALUE-"))
238 (structure-value (gensym "STRUCTURE-VALUE-")))
239 `(lambda (,new-value ,structure-value)
240 (setf (,place-function-name ,structure-value)
242 ;; no problem, can just use the ordinary expansion
243 `(function (setf ,place-function-name))))
246 There's apparently a bug in CEILING optimization which caused
247 Douglas Crosher to patch the CMU CL version. Martin Atzmueller
248 applied the patches to SBCL and they didn't seem to cause problems
249 (as reported sbcl-devel 2001-05-04). However, since the patches
250 modify nontrivial code which was apparently written incorrectly
251 the first time around, until regression tests are written I'm not
252 comfortable merging the patches in the CVS version of SBCL.
255 (TIME (ROOM T)) reports more than 200 Mbytes consed even for
256 a clean, just-started SBCL system. And it seems to be right:
257 (ROOM T) can bring a small computer to its knees for a *long*
258 time trying to GC afterwards. Surely there's some more economical
259 way to implement (ROOM T).
261 Daniel Barlow doesn't know what fixed this, but observes that it
262 doesn't seem to be the case in 0.8.7.3 any more. Instead, (ROOM T)
263 in a fresh SBCL causes
265 debugger invoked on a SB-INT:BUG in thread 5911:
266 failed AVER: "(SAP= CURRENT END)"
268 unless a GC has happened beforehand.
271 When the compiler inline expands functions, it may be that different
272 kinds of return values are generated from different code branches.
273 E.g. an inline expansion of POSITION generates integer results
274 from one branch, and NIL results from another. When that inline
275 expansion is used in a context where only one of those results
278 (aref *a1* (position x *a2*)))
279 and the compiler can't prove that the unacceptable branch is
280 never taken, then bogus type mismatch warnings can be generated.
281 If you need to suppress the type mismatch warnings, you can
282 suppress the inline expansion,
284 #+sbcl (declare (notinline position)) ; to suppress bug 117 bogowarnings
285 (aref *a1* (position x *a2*)))
286 or, sometimes, suppress them by declaring the result to be of an
289 (aref *a1* (the integer (position x *a2*))))
291 This is not a new compiler problem in 0.7.0, but the new compiler
292 transforms for FIND, POSITION, FIND-IF, and POSITION-IF make it
293 more conspicuous. If you don't need performance from these functions,
294 and the bogus warnings are a nuisance for you, you can return to
295 your pre-0.7.0 state of grace with
296 #+sbcl (declaim (notinline find position find-if position-if)) ; bug 117..
301 As of version 0.pre7.14, SBCL's implementation of MACROLET makes
302 the entire lexical environment at the point of MACROLET available
303 in the bodies of the macroexpander functions. In particular, it
304 allows the function bodies (which run at compile time) to try to
305 access lexical variables (which are only defined at runtime).
306 It doesn't even issue a warning, which is bad.
308 The SBCL behavior arguably conforms to the ANSI spec (since the
309 spec says that the behavior is undefined, ergo anything conforms).
310 However, it would be better to issue a compile-time error.
311 Unfortunately I (WHN) don't see any simple way to detect this
312 condition in order to issue such an error, so for the meantime
313 SBCL just does this weird broken "conforming" thing.
315 The ANSI standard says, in the definition of the special operator
317 The macro-expansion functions defined by MACROLET are defined
318 in the lexical environment in which the MACROLET form appears.
319 Declarations and MACROLET and SYMBOL-MACROLET definitions affect
320 the local macro definitions in a MACROLET, but the consequences
321 are undefined if the local macro definitions reference any
322 local variable or function bindings that are visible in that
324 Then it seems to contradict itself by giving the example
326 (macrolet ((fudge (z)
327 ;The parameters x and flag are not accessible
328 ; at this point; a reference to flag would be to
329 ; the global variable of that name.
330 ` (if flag (* ,z ,z) ,z)))
331 ;The parameters x and flag are accessible here.
335 The comment "a reference to flag would be to the global variable
336 of the same name" sounds like good behavior for the system to have.
337 but actual specification quoted above says that the actual behavior
340 (Since 0.7.8.23 macroexpanders are defined in a restricted version
341 of the lexical environment, containing no lexical variables and
342 functions, which seems to conform to ANSI and CLtL2, but signalling
343 a STYLE-WARNING for references to variables similar to locals might
347 Ideally, uninterning a symbol would allow it, and its associated
348 FDEFINITION and PROCLAIM data, to be reclaimed by the GC. However,
349 at least as of sbcl-0.7.0, this isn't the case. Information about
350 FDEFINITIONs and PROCLAIMed properties is stored in globaldb.lisp
351 essentially in ordinary (non-weak) hash tables keyed by symbols.
352 Thus, once a system has an entry in this system, it tends to live
353 forever, even when it is uninterned and all other references to it
357 (reported by Jesse Bouwman 2001-10-24 through the unfortunately
358 prominent SourceForge web/db bug tracking system, which is
359 unfortunately not a reliable way to get a timely response from
360 the SBCL maintainers)
361 In the course of trying to build a test case for an
362 application error, I encountered this behavior:
363 If you start up sbcl, and then lay on CTRL-C for a
364 minute or two, the lisp process will eventually say:
365 %PRIMITIVE HALT called; the party is over.
366 and throw you into the monitor. If I start up lisp,
367 attach to the process with strace, and then do the same
368 (abusive) thing, I get instead:
369 access failure in heap page not marked as write-protected
370 and the monitor again. I don't know enough to have the
371 faintest idea of what is going on here.
372 This is with sbcl 6.12, uname -a reports:
373 Linux prep 2.2.19 #4 SMP Tue Apr 24 13:59:52 CDT 2001 i686 unknown
374 I (WHN) have verified that the same thing occurs on sbcl-0.pre7.141
375 under OpenBSD 2.9 on my X86 laptop. Do be patient when you try it:
376 it took more than two minutes (but less than five) for me.
380 ANSI allows types `(COMPLEX ,FOO) to use very hairy values for
381 FOO, e.g. (COMPLEX (AND REAL (SATISFIES ODDP))). The old CMU CL
382 COMPLEX implementation didn't deal with this, and hasn't been
383 upgraded to do so. (This doesn't seem to be a high priority
384 conformance problem, since seems hard to construct useful code
387 [ partially fixed by CSR in 0.8.17.17 because of a PFD ansi-tests
388 report that (COMPLEX RATIO) was failing; still failing on types of
389 the form (AND NUMBER (SATISFIES REALP) (SATISFIES ZEROP)). ]
391 b. (fixed in 0.8.3.43)
394 Floating point errors are reported poorly. E.g. on x86 OpenBSD
397 debugger invoked on condition of type SB-KERNEL:FLOATING-POINT-EXCEPTION:
398 An arithmetic error SB-KERNEL:FLOATING-POINT-EXCEPTION was signalled.
399 No traps are enabled? How can this be?
400 It should be possible to be much more specific (overflow, division
401 by zero, etc.) and of course the "How can this be?" should be fixable.
403 See also bugs #45.c and #183
406 (reported by Robert E. Brown 2002-04-16)
407 When a function is called with too few arguments, causing the
408 debugger to be entered, the uninitialized slots in the bad call frame
409 seem to cause GCish problems, being interpreted as tagged data even
410 though they're not. In particular, executing ROOM in the
411 debugger at that point causes AVER failures:
414 * (lisp-implementation-version)
420 failed AVER: "(SAP= CURRENT END)"
421 (Christophe Rhodes reports that this doesn't occur on the SPARC, which
422 isn't too surprising since there are many differences in stack
423 implementation and GC conservatism between the X86 and other ports.)
425 This is probably the same bug as 216
428 The compiler sometimes tries to constant-fold expressions before
429 it checks to see whether they can be reached. This can lead to
430 bogus warnings about errors in the constant folding, e.g. in code
433 (WRITE-STRING (> X 0) "+" "0"))
434 compiled in a context where the compiler can prove that X is NIL,
435 and the compiler complains that (> X 0) causes a type error because
436 NIL isn't a valid argument to #'>. Until sbcl-0.7.4.10 or so this
437 caused a full WARNING, which made the bug really annoying because then
438 COMPILE and COMPILE-FILE returned FAILURE-P=T for perfectly legal
439 code. Since then the warning has been downgraded to STYLE-WARNING,
440 so it's still a bug but at least it's a little less annoying.
442 183: "IEEE floating point issues"
443 Even where floating point handling is being dealt with relatively
444 well (as of sbcl-0.7.5, on sparc/sunos and alpha; see bug #146), the
445 accrued-exceptions and current-exceptions part of the fp control
446 word don't seem to bear much relation to reality. E.g. on
450 debugger invoked on condition of type DIVISION-BY-ZERO:
451 arithmetic error DIVISION-BY-ZERO signalled
452 0] (sb-vm::get-floating-point-modes)
454 (:TRAPS (:OVERFLOW :INVALID :DIVIDE-BY-ZERO)
455 :ROUNDING-MODE :NEAREST
456 :CURRENT-EXCEPTIONS NIL
457 :ACCRUED-EXCEPTIONS (:INEXACT)
460 * (sb-vm::get-floating-point-modes)
461 (:TRAPS (:OVERFLOW :INVALID :DIVIDE-BY-ZERO)
462 :ROUNDING-MODE :NEAREST
463 :CURRENT-EXCEPTIONS (:INEXACT)
464 :ACCRUED-EXCEPTIONS (:INEXACT)
467 188: "compiler performance fiasco involving type inference and UNION-TYPE"
471 (declare (optimize (safety 3)))
472 (declare (optimize (compilation-speed 2)))
473 (declare (optimize (speed 1) (debug 1) (space 1)))
475 (declare (type (integer 0) start))
476 (print (incf start 22))
477 (print (incf start 26))
478 (print (incf start 28)))
480 (declare (type (integer 0) start))
481 (print (incf start 22))
482 (print (incf start 26)))
484 (declare (type (integer 0) start))
485 (print (incf start 22))
486 (print (incf start 26))))))
488 This example could be solved with clever enough constraint
489 propagation or with SSA, but consider
494 The careful type of X is {2k} :-(. Is it really important to be
495 able to work with unions of many intervals?
497 191: "Miscellaneous PCL deficiencies"
498 (reported by Alexey Dejneka sbcl-devel 2002-08-04)
499 a. DEFCLASS does not inform the compiler about generated
500 functions. Compiling a file with
504 (WITH-SLOTS (A-CLASS-X) A
506 results in a STYLE-WARNING:
508 SB-SLOT-ACCESSOR-NAME::|COMMON-LISP-USER A-CLASS-X slot READER|
510 APD's fix for this was checked in to sbcl-0.7.6.20, but Pierre
511 Mai points out that the declamation of functions is in fact
512 incorrect in some cases (most notably for structure
513 classes). This means that at present erroneous attempts to use
514 WITH-SLOTS and the like on classes with metaclass STRUCTURE-CLASS
515 won't get the corresponding STYLE-WARNING.
516 c. (fixed in 0.8.4.23)
518 201: "Incautious type inference from compound types"
519 a. (reported by APD sbcl-devel 2002-09-17)
521 (LET ((Y (CAR (THE (CONS INTEGER *) X))))
523 (FORMAT NIL "~S IS ~S, Y = ~S"
530 (FOO ' (1 . 2)) => "NIL IS INTEGER, Y = 1"
534 (declare (type (array * (4 4)) x))
536 (setq x (make-array '(4 4)))
537 (adjust-array y '(3 5))
538 (= (array-dimension y 0) (eval `(array-dimension ,y 0)))))
540 * (foo (make-array '(4 4) :adjustable t))
543 205: "environment issues in cross compiler"
544 (These bugs have no impact on user code, but should be fixed or
546 a. Macroexpanders introduced with MACROLET are defined in the null
548 b. The body of (EVAL-WHEN (:COMPILE-TOPLEVEL) ...) is evaluated in
549 the null lexical environment.
550 c. The cross-compiler cannot inline functions defined in a non-null
553 206: ":SB-FLUID feature broken"
554 (reported by Antonio Martinez-Shotton sbcl-devel 2002-10-07)
555 Enabling :SB-FLUID in the target-features list in sbcl-0.7.8 breaks
558 207: "poorly distributed SXHASH results for compound data"
559 SBCL's SXHASH could probably try a little harder. ANSI: "the
560 intent is that an implementation should make a good-faith
561 effort to produce hash-codes that are well distributed
562 within the range of non-negative fixnums". But
563 (let ((hits (make-hash-table)))
566 (let* ((ij (cons i j))
567 (newlist (push ij (gethash (sxhash ij) hits))))
569 (format t "~&collision: ~S~%" newlist))))))
570 reports lots of collisions in sbcl-0.7.8. A stronger MIX function
571 would be an obvious way of fix. Maybe it would be acceptably efficient
572 to redo MIX using a lookup into a 256-entry s-box containing
573 29-bit pseudorandom numbers?
575 211: "keywords processing"
576 a. :ALLOW-OTHER-KEYS T should allow a function to receive an odd
577 number of keyword arguments.
579 212: "Sequence functions and circular arguments"
580 COERCE, MERGE and CONCATENATE go into an infinite loop when given
581 circular arguments; it would be good for the user if they could be
582 given an error instead (ANSI 17.1.1 allows this behaviour on the part
583 of the implementation, as conforming code cannot give non-proper
584 sequences to these functions. MAP also has this problem (and
585 solution), though arguably the convenience of being able to do
586 (MAP 'LIST '+ FOO '#1=(1 . #1#))
587 might be classed as more important (though signalling an error when
588 all of the arguments are circular is probably desireable).
590 213: "Sequence functions and type checking"
591 b. MAP, when given a type argument that is SUBTYPEP LIST, does not
592 check that it will return a sequence of the given type. Fixing
593 it along the same lines as the others (cf. work done around
594 sbcl-0.7.8.45) is possible, but doing so efficiently didn't look
595 entirely straightforward.
596 c. All of these functions will silently accept a type of the form
598 whether or not the return value is of this type. This is
599 probably permitted by ANSI (see "Exceptional Situations" under
600 ANSI MAKE-SEQUENCE), but the DERIVE-TYPE mechanism does not
601 know about this escape clause, so code of the form
602 (INTEGERP (CAR (MAKE-SEQUENCE '(CONS INTEGER *) 2)))
603 can erroneously return T.
605 215: ":TEST-NOT handling by functions"
606 a. FIND and POSITION currently signal errors when given non-NIL for
607 both their :TEST and (deprecated) :TEST-NOT arguments, but by
608 ANSI 17.2 "the consequences are unspecified", which by ANSI 1.4.2
609 means that the effect is "unpredictable but harmless". It's not
610 clear what that actually means; it may preclude conforming
611 implementations from signalling errors.
612 b. COUNT, REMOVE and the like give priority to a :TEST-NOT argument
613 when conflict occurs. As a quality of implementation issue, it
614 might be preferable to treat :TEST and :TEST-NOT as being in some
615 sense the same &KEY, and effectively take the first test function in
617 c. Again, a quality of implementation issue: it would be good to issue a
618 STYLE-WARNING at compile-time for calls with :TEST-NOT, and a
619 WARNING for calls with both :TEST and :TEST-NOT; possibly this
620 latter should be WARNed about at execute-time too.
622 216: "debugger confused by frames with invalid number of arguments"
623 In sbcl-0.7.8.51, executing e.g. (VECTOR-PUSH-EXTEND T), BACKTRACE, Q
624 leaves the system confused, enough so that (QUIT) no longer works.
625 It's as though the process of working with the uninitialized slot in
626 the bad VECTOR-PUSH-EXTEND frame causes GC problems, though that may
627 not be the actual problem. (CMU CL 18c doesn't have problems with this.)
629 This is probably the same bug as 162
631 217: "Bad type operations with FUNCTION types"
634 * (values-type-union (specifier-type '(function (base-char)))
635 (specifier-type '(function (integer))))
637 #<FUN-TYPE (FUNCTION (BASE-CHAR) *)>
639 It causes insertion of wrong type assertions into generated
643 (let ((f (etypecase x
644 (character #'write-char)
645 (integer #'write-byte))))
648 (character (write-char x s))
649 (integer (write-byte x s)))))
651 Then (FOO #\1 *STANDARD-OUTPUT*) signals type error.
653 (In 0.7.9.1 the result type is (FUNCTION * *), so Python does not
654 produce invalid code, but type checking is not accurate.)
656 235: "type system and inline expansion"
658 (declaim (ftype (function (cons) number) acc))
659 (declaim (inline acc))
661 (the number (car c)))
664 (values (locally (declare (optimize (safety 0)))
666 (locally (declare (optimize (safety 3)))
669 (foo '(nil) '(t)) => NIL, T.
671 237: "Environment arguments to type functions"
672 a. Functions SUBTYPEP, TYPEP, UPGRADED-ARRAY-ELEMENT-TYPE, and
673 UPGRADED-COMPLEX-PART-TYPE now have an optional environment
674 argument, but they ignore it completely. This is almost
675 certainly not correct.
676 b. Also, the compiler's optimizers for TYPEP have not been informed
677 about the new argument; consequently, they will not transform
678 calls of the form (TYPEP 1 'INTEGER NIL), even though this is
679 just as optimizeable as (TYPEP 1 'INTEGER).
681 238: "REPL compiler overenthusiasm for CLOS code"
683 * (defclass foo () ())
684 * (defmethod bar ((x foo) (foo foo)) (call-next-method))
685 causes approximately 100 lines of code deletion notes. Some
686 discussion on this issue happened under the title 'Three "interesting"
687 bugs in PCL', resulting in a fix for this oververbosity from the
688 compiler proper; however, the problem persists in the interactor
689 because the notion of original source is not preserved: for the
690 compiler, the original source of the above expression is (DEFMETHOD
691 BAR ((X FOO) (FOO FOO)) (CALL-NEXT-METHOD)), while by the time the
692 compiler gets its hands on the code needing compilation from the REPL,
693 it has been macroexpanded several times.
695 A symptom of the same underlying problem, reported by Tony Martinez:
697 (with-input-from-string (*query-io* " no")
699 (simple-type-error () 'error))
701 ; (SB-KERNEL:FLOAT-WAIT)
703 ; note: deleting unreachable code
704 ; compilation unit finished
707 242: "WRITE-SEQUENCE suboptimality"
708 (observed from clx performance)
709 In sbcl-0.7.13, WRITE-SEQUENCE of a sequence of type
710 (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)) on a stream with element-type
711 (UNSIGNED-BYTE 8) will write to the stream one byte at a time,
712 rather than writing the sequence in one go, leading to severe
713 performance degradation.
714 As of sbcl-0.9.0.36, this is solved for fd-streams, so is less of a
715 problem in practice. (Fully fixing this would require adding a
716 ansi-stream-n-bout slot and associated methods to write a byte
717 sequence to ansi-stream, similar to the existing ansi-stream-sout
720 243: "STYLE-WARNING overenthusiasm for unused variables"
721 (observed from clx compilation)
722 In sbcl-0.7.14, in the presence of the macros
723 (DEFMACRO FOO (X) `(BAR ,X))
724 (DEFMACRO BAR (X) (DECLARE (IGNORABLE X)) 'NIL)
725 somewhat surprising style warnings are emitted for
726 (COMPILE NIL '(LAMBDA (Y) (FOO Y))):
728 ; (LAMBDA (Y) (FOO Y))
730 ; caught STYLE-WARNING:
731 ; The variable Y is defined but never used.
733 245: bugs in disassembler
734 b. On X86 operand size prefix is not recognized.
737 (defun foo (&key (a :x))
741 does not cause a warning. (BTW: old SBCL issued a warning, but for a
742 function, which was never called!)
745 Compiler does not emit warnings for
747 a. (lambda () (svref (make-array 8 :adjustable t) 1))
750 (list (let ((y (the real x)))
751 (unless (floatp y) (error ""))
756 (declare (optimize (debug 0)))
757 (declare (type vector x))
758 (list (fill-pointer x)
762 Complex array type does not have corresponding type specifier.
764 This is a problem because the compiler emits optimization notes when
765 you use a non-simple array, and without a type specifier for hairy
766 array types, there's no good way to tell it you're doing it
767 intentionally so that it should shut up and just compile the code.
769 Another problem is confusing error message "asserted type ARRAY
770 conflicts with derived type (VALUES SIMPLE-VECTOR &OPTIONAL)" during
771 compiling (LAMBDA (V) (VALUES (SVREF V 0) (VECTOR-POP V))).
773 The last problem is that when type assertions are converted to type
774 checks, types are represented with type specifiers, so we could lose
775 complex attribute. (Now this is probably not important, because
776 currently checks for complex arrays seem to be performed by
780 (compile nil '(lambda () (aref (make-array 0) 0))) compiles without
781 warning. Analogous cases with the index and length being equal and
782 greater than 0 are warned for; the problem here seems to be that the
783 type required for an array reference of this type is (INTEGER 0 (0))
784 which is canonicalized to NIL.
789 (t1 (specifier-type s)))
790 (eval `(defstruct ,s))
791 (type= t1 (specifier-type s)))
796 b. The same for CSUBTYPEP.
798 262: "yet another bug in inline expansion of local functions"
799 During inline expansion of a local function Python can try to
800 reference optimized away objects (functions, variables, CTRANs from
801 tags and blocks), which later may lead to problems. Some of the
802 cases are worked around by forbidding expansion in such cases, but
803 the better way would be to reimplement inline expansion by copying
807 David Lichteblau provided (sbcl-devel 2003-06-01) a patch to fix
808 behaviour of streams with element-type (SIGNED-BYTE 8). The patch
809 looks reasonable, if not obviously correct; however, it caused the
810 PPC/Linux port to segfault during warm-init while loading
811 src/pcl/std-class.fasl. A workaround patch was made, but it would
812 be nice to understand why the first patch caused problems, and to
813 fix the cause if possible.
815 268: "wrong free declaration scope"
816 The following code must signal type error:
818 (locally (declare (optimize (safety 3)))
819 (flet ((foo (x &optional (y (car x)))
820 (declare (optimize (safety 0)))
822 (funcall (eval #'foo) 1)))
825 In the following function constraint propagator optimizes nothing:
828 (declare (integer x))
829 (declare (optimize speed))
837 Compilation of the following two forms causes "X is unbound" error:
839 (symbol-macrolet ((x pi))
840 (macrolet ((foo (y) (+ x y)))
841 (declaim (inline bar))
847 (See (COERCE (CDR X) 'FUNCTION) in IR1-CONVERT-INLINE-LAMBDA.)
850 CLHS says that type declaration of a symbol macro should not affect
851 its expansion, but in SBCL it does. (If you like magic and want to
852 fix it, don't forget to change all uses of MACROEXPAND to
856 The following code (taken from CLOCC) takes a lot of time to compile:
859 (declare (type (integer 0 #.large-constant) n))
862 (fixed in 0.8.2.51, but a test case would be good)
865 b. The same as in a., but using MULTIPLE-VALUE-SETQ instead of SETQ.
867 (defmethod faa ((*faa* double-float))
868 (set '*faa* (when (< *faa* 0) (- *faa*)))
870 (faa 1d0) => type error
872 279: type propagation error -- correctly inferred type goes astray?
873 In sbcl-0.8.3 and sbcl-0.8.1.47, the warning
874 The binding of ABS-FOO is a (VALUES (INTEGER 0 0)
875 &OPTIONAL), not a (INTEGER 1 536870911)
876 is emitted when compiling this file:
877 (declaim (ftype (function ((integer 0 #.most-positive-fixnum))
878 (integer #.most-negative-fixnum 0))
883 (let* (;; Uncomment this for a type mismatch warning indicating
884 ;; that the type of (FOO X) is correctly understood.
885 #+nil (fs-foo (float-sign (foo x)))
886 ;; Uncomment this for a type mismatch warning
887 ;; indicating that the type of (ABS (FOO X)) is
888 ;; correctly understood.
889 #+nil (fs-abs-foo (float-sign (abs (foo x))))
890 ;; something wrong with this one though
891 (abs-foo (abs (foo x))))
892 (declare (type (integer 1 100) abs-foo))
897 283: Thread safety: libc functions
898 There are places that we call unsafe-for-threading libc functions
899 that we should find alternatives for, or put locks around. Known or
900 strongly suspected problems, as of 0.8.3.10: please update this
901 bug instead of creating new ones
903 localtime() - called for timezone calculations in code/time.lisp
905 284: Thread safety: special variables
906 There are lots of special variables in SBCL, and I feel sure that at
907 least some of them are indicative of potentially thread-unsafe
908 parts of the system. See doc/internals/notes/threading-specials
910 286: "recursive known functions"
911 Self-call recognition conflicts with known function
912 recognition. Currently cross compiler and target COMPILE do not
913 recognize recursion, and in target compiler it can be disabled. We
914 can always disable it for known functions with RECURSIVE attribute,
915 but there remains a possibility of a function with a
916 (tail)-recursive simplification pass and transforms/VOPs for base
919 287: PPC/Linux miscompilation or corruption in first GC
920 When the runtime is compiled with -O3 on certain PPC/Linux machines, a
921 segmentation fault is reported at the point of first triggered GC,
922 during the compilation of DEFSTRUCT WRAPPER. As a temporary workaround,
923 the runtime is no longer compiled with -O3 on PPC/Linux, but it is likely
924 that this merely obscures, not solves, the underlying problem; as and when
925 underlying problems are fixed, it would be worth trying again to provoke
928 288: fundamental cross-compilation issues (from old UGLINESS file)
929 Using host floating point numbers to represent target floating point
930 numbers, or host characters to represent target characters, is
931 theoretically shaky. (The characters are OK as long as the characters
932 are in the ANSI-guaranteed character set, though, so they aren't a
933 real problem as long as the sources don't need anything but that;
934 the floats are a real problem.)
936 289: "type checking and source-transforms"
938 (block nil (let () (funcall #'+ (eval 'nil) (eval '1) (return :good))))
941 Our policy is to check argument types at the moment of a call. It
942 disagrees with ANSI, which says that type assertions are put
943 immediately onto argument expressions, but is easier to implement in
944 IR1 and is more compatible to type inference, inline expansion,
945 etc. IR1-transforms automatically keep this policy, but source
946 transforms for associative functions (such as +), being applied
947 during IR1-convertion, do not. It may be tolerable for direct calls
948 (+ x y z), but for (FUNCALL #'+ x y z) it is non-conformant.
950 b. Another aspect of this problem is efficiency. [x y + z +]
951 requires less registers than [x y z + +]. This transformation is
952 currently performed with source transforms, but it would be good to
953 also perform it in IR1 optimization phase.
955 290: Alpha floating point and denormalized traps
956 In SBCL 0.8.3.6x on the alpha, we work around what appears to be a
957 hardware or kernel deficiency: the status of the enable/disable
958 denormalized-float traps bit seems to be ambiguous; by the time we
959 get to os_restore_fp_control after a trap, denormalized traps seem
960 to be enabled. Since we don't want a trap every time someone uses a
961 denormalized float, in general, we mask out that bit when we restore
962 the control word; however, this clobbers any change the user might
966 LOOP with non-constant arithmetic step clauses suffers from overzealous
967 type constraint: code of the form
968 (loop for d of-type double-float from 0d0 to 10d0 by x collect d)
969 compiles to a type restriction on X of (AND DOUBLE-FLOAT (REAL
970 (0))). However, an integral value of X should be legal, because
971 successive adds of integers to double-floats produces double-floats,
972 so none of the type restrictions in the code is violated.
974 300: (reported by Peter Graves) Function PEEK-CHAR checks PEEK-TYPE
975 argument type only after having read a character. This is caused
976 with EXPLICIT-CHECK attribute in DEFKNOWN. The similar problem
977 exists with =, /=, <, >, <=, >=. They were fixed, but it is probably
978 less error prone to have EXPLICIT-CHECK be a local declaration,
979 being put into the definition, instead of an attribute being kept in
980 a separate file; maybe also put it into SB-EXT?
982 301: ARRAY-SIMPLE-=-TYPE-METHOD breaks on corner cases which can arise
983 in NOTE-ASSUMED-TYPES
984 In sbcl-0.8.7.32, compiling the file
986 (declare (type integer x))
987 (declare (type (vector (or hash-table bit)) y))
990 (declare (type integer x))
991 (declare (type (simple-array base (2)) y))
994 failed AVER: "(NOT (AND (NOT EQUALP) CERTAINP))"
996 303: "nonlinear LVARs" (aka MISC.293)
998 (multiple-value-call #'list
1000 (multiple-value-prog1
1001 (eval '(values :a :b :c))
1007 (throw 'bar (values 3 4)))))))))))
1009 (BUU 1) returns garbage.
1011 The problem is that both EVALs sequentially write to the same LVAR.
1013 306: "Imprecise unions of array types"
1015 (declare (optimize speed)
1016 (type (or (array cons) (array vector)) x))
1018 (foo #((0))) => TYPE-ERROR
1025 ,@(loop for x across sb-vm:*specialized-array-element-type-properties*
1026 collect `(array ,(sb-vm:saetp-specifier x)))))
1027 => NIL, T (when it should be T, T)
1029 309: "Dubious values for implementation limits"
1030 (reported by Bruno Haible sbcl-devel "Incorrect value of
1031 multiple-values-limit" 2004-04-19)
1032 (values-list (make-list 1000000)), on x86/linux, signals a stack
1033 exhaustion condition, despite MULTIPLE-VALUES-LIMIT being
1034 significantly larger than 1000000. There are probably similar
1035 dubious values for CALL-ARGUMENTS-LIMIT (see cmucl-help/cmucl-imp
1036 around the same time regarding a call to LIST on sparc with 1000
1037 arguments) and other implementation limit constants.
1039 314: "LOOP :INITIALLY clauses and scope of initializers"
1040 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
1041 test suite, originally by Thomas F. Burdick.
1042 ;; <http://www.lisp.org/HyperSpec/Body/sec_6-1-7-2.html>
1043 ;; According to the HyperSpec 6.1.2.1.4, in for-as-equals-then, var is
1044 ;; initialized to the result of evaluating form1. 6.1.7.2 says that
1045 ;; initially clauses are evaluated in the loop prologue, which precedes all
1046 ;; loop code except for the initial settings provided by with, for, or as.
1047 (loop :for x = 0 :then (1+ x)
1048 :for y = (1+ x) :then (ash y 1)
1049 :for z :across #(1 3 9 27 81 243)
1051 :initially (assert (zerop x)) :initially (assert (= 2 w))
1052 :until (>= w 100) :collect w)
1053 Expected: (2 6 15 38)
1056 318: "stack overflow in compiler warning with redefined class"
1057 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
1060 (setf (find-class 'foo) nil)
1061 (defstruct foo slot-1)
1062 This used to give a stack overflow from within the printer, which has
1063 been fixed as of 0.8.16.11. Current result:
1065 ; can't compile TYPEP of anonymous or undefined class:
1066 ; #<SB-KERNEL:STRUCTURE-CLASSOID FOO>
1068 debugger invoked on a TYPE-ERROR in thread 19973:
1069 The value NIL is not of type FUNCTION.
1071 CSR notes: it's not really clear what it should give: is (SETF FIND-CLASS)
1072 meant to be enough to delete structure classes from the system?
1074 319: "backquote with comma inside array"
1075 reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
1077 (read-from-string "`#1A(1 2 ,(+ 2 2) 4)")
1079 #(1 2 ((SB-IMPL::|,|) + 2 2) 4)
1080 which probably isn't intentional.
1082 324: "STREAMs and :ELEMENT-TYPE with large bytesize"
1083 In theory, (open foo :element-type '(unsigned-byte <x>)) should work
1084 for all positive integral <x>. At present, it only works for <x> up
1085 to about 1024 (and similarly for signed-byte), so
1086 (open "/dev/zero" :element-type '(unsigned-byte 1025))
1087 gives an error in sbcl-0.8.10.
1089 325: "CLOSE :ABORT T on supeseding streams"
1090 Closing a stream opened with :IF-EXISTS :SUPERSEDE with :ABORT T leaves no
1091 file on disk, even if one existed before opening.
1093 The illegality of this is not crystal clear, as the ANSI dictionary
1094 entry for CLOSE says that when :ABORT is T superseded files are not
1095 superseded (ie. the original should be restored), whereas the OPEN
1096 entry says about :IF-EXISTS :SUPERSEDE "If possible, the
1097 implementation should not destroy the old file until the new stream
1098 is closed." -- implying that even though undesirable, early deletion
1099 is legal. Restoring the original would none the less be the polite
1102 326: "*PRINT-CIRCLE* crosstalk between streams"
1103 In sbcl-0.8.10.48 it's possible for *PRINT-CIRCLE* references to be
1104 mixed between streams when output operations are intermingled closely
1105 enough (as by doing output on S2 from within (PRINT-OBJECT X S1) in the
1106 test case below), so that e.g. the references #2# appears on a stream
1107 with no preceding #2= on that stream to define it (because the #2= was
1108 sent to another stream).
1109 (cl:in-package :cl-user)
1110 (defstruct foo index)
1111 (defparameter *foo* (make-foo :index 4))
1113 (defparameter *bar* (make-bar))
1114 (defparameter *tangle* (list *foo* *bar* *foo*))
1115 (defmethod print-object ((foo foo) stream)
1116 (let ((index (foo-index foo)))
1117 (format *trace-output*
1118 "~&-$- emitting FOO ~D, ambient *BAR*=~S~%"
1120 (format stream "[FOO ~D]" index))
1122 (let ((tsos (make-string-output-stream))
1123 (ssos (make-string-output-stream)))
1124 (let ((*print-circle* t)
1125 (*trace-output* tsos)
1126 (*standard-output* ssos))
1127 (prin1 *tangle* *standard-output*))
1128 (let ((string (get-output-stream-string ssos)))
1129 (unless (string= string "(#1=[FOO 4] #S(BAR) #1#)")
1130 ;; In sbcl-0.8.10.48 STRING was "(#1=[FOO 4] #2# #1#)".:-(
1131 (error "oops: ~S" string)))))
1132 It might be straightforward to fix this by turning the
1133 *CIRCULARITY-HASH-TABLE* and *CIRCULARITY-COUNTER* variables into
1134 per-stream slots, but (1) it would probably be sort of messy faking
1135 up the special variable binding semantics using UNWIND-PROTECT and
1136 (2) it might be sort of a pain to test that no other bugs had been
1139 328: "Profiling generic functions", transplanted from #241
1140 (from tonyms on #lisp IRC 2003-02-25)
1141 In sbcl-0.7.12.55, typing
1142 (defclass foo () ((bar :accessor foo-bar)))
1145 (defclass foo () ((bar :accessor foo-bar)))
1146 gives the error message
1147 "#:FOO-BAR already names an ordinary function or a macro."
1149 Problem: when a generic function is profiled, it appears as an ordinary
1150 function to PCL. (Remembering the uninterned accessor is OK, as the
1151 redefinition must be able to remove old accessors from their generic
1154 329: "Sequential class redefinition"
1155 reported by Bruno Haible:
1156 (defclass reactor () ((max-temp :initform 10000000)))
1157 (defvar *r1* (make-instance 'reactor))
1158 (defvar *r2* (make-instance 'reactor))
1159 (slot-value *r1* 'max-temp)
1160 (slot-value *r2* 'max-temp)
1161 (defclass reactor () ((uptime :initform 0)))
1162 (slot-value *r1* 'uptime)
1163 (defclass reactor () ((uptime :initform 0) (max-temp :initform 10000)))
1164 (slot-value *r1* 'max-temp) ; => 10000
1165 (slot-value *r2* 'max-temp) ; => 10000000 oops...
1168 The method effective when the wrapper is obsoleted can be saved
1169 in the wrapper, and then to update the instance just run through
1170 all the old wrappers in order from oldest to newest.
1172 332: "fasl stack inconsistency in structure redefinition"
1173 (reported by Tim Daly Jr sbcl-devel 2004-05-06)
1174 Even though structure redefinition is undefined by the standard, the
1175 following behaviour is suboptimal: running
1176 (defun stimulate-sbcl ()
1177 (let ((filename (format nil "/tmp/~A.lisp" (gensym))))
1178 ;;create a file which redefines a structure incompatibly
1179 (with-open-file (f filename :direction :output :if-exists :supersede)
1180 (print '(defstruct astruct foo) f)
1181 (print '(defstruct astruct foo bar) f))
1182 ;;compile and load the file, then invoke the continue restart on
1183 ;;the structure redefinition error
1184 (handler-bind ((error (lambda (c) (continue c))))
1185 (load (compile-file filename)))))
1187 and choosing the CONTINUE restart yields the message
1188 debugger invoked on a SB-INT:BUG in thread 27726:
1189 fasl stack not empty when it should be
1191 336: "slot-definitions must retain the generic functions of accessors"
1192 reported by Tony Martinez:
1193 (defclass foo () ((bar :reader foo-bar)))
1194 (defun foo-bar (x) x)
1195 (defclass foo () ((bar :reader get-bar))) ; => error, should work
1197 Note: just punting the accessor removal if the fdefinition
1198 is not a generic function is not enough:
1200 (defclass foo () ((bar :reader foo-bar)))
1201 (defvar *reader* #'foo-bar)
1202 (defun foo-bar (x) x)
1203 (defclass foo () ((bar :initform 'ok :reader get-bar)))
1204 (funcall *reader* (make-instance 'foo)) ; should be an error, since
1205 ; the method must be removed
1206 ; by the class redefinition
1208 Fixing this should also fix a subset of #328 -- update the
1209 description with a new test-case then.
1211 337: MAKE-METHOD and user-defined method classes
1212 (reported by Bruno Haible sbcl-devel 2004-06-11)
1216 (defclass user-method (standard-method) (myslot))
1217 (defmacro def-user-method (name &rest rest)
1218 (let* ((lambdalist-position (position-if #'listp rest))
1219 (qualifiers (subseq rest 0 lambdalist-position))
1220 (lambdalist (elt rest lambdalist-position))
1221 (body (subseq rest (+ lambdalist-position 1)))
1223 (subseq lambdalist 0 (or
1225 (lambda (x) (member x lambda-list-keywords))
1227 (length lambdalist))))
1228 (specializers (mapcar #'find-class
1229 (mapcar (lambda (x) (if (consp x) (second x) t))
1231 (unspecialized-required-part
1232 (mapcar (lambda (x) (if (consp x) (first x) x)) required-part))
1233 (unspecialized-lambdalist
1234 (append unspecialized-required-part
1235 (subseq lambdalist (length required-part)))))
1238 (MAKE-INSTANCE 'USER-METHOD
1239 :QUALIFIERS ',qualifiers
1240 :LAMBDA-LIST ',unspecialized-lambdalist
1241 :SPECIALIZERS ',specializers
1243 (LAMBDA (ARGUMENTS NEXT-METHODS-LIST)
1244 (FLET ((NEXT-METHOD-P () NEXT-METHODS-LIST)
1245 (CALL-NEXT-METHOD (&REST NEW-ARGUMENTS)
1246 (UNLESS NEW-ARGUMENTS (SETQ NEW-ARGUMENTS ARGUMENTS))
1247 (IF (NULL NEXT-METHODS-LIST)
1248 (ERROR "no next method for arguments ~:S" ARGUMENTS)
1249 (FUNCALL (SB-PCL:METHOD-FUNCTION
1250 (FIRST NEXT-METHODS-LIST))
1251 NEW-ARGUMENTS (REST NEXT-METHODS-LIST)))))
1252 (APPLY #'(LAMBDA ,unspecialized-lambdalist ,@body) ARGUMENTS)))))
1256 (defgeneric test-um03 (x))
1257 (defmethod test-um03 ((x integer))
1258 (list* 'integer x (not (null (next-method-p))) (call-next-method)))
1259 (def-user-method test-um03 ((x rational))
1260 (list* 'rational x (not (null (next-method-p))) (call-next-method)))
1261 (defmethod test-um03 ((x real))
1262 (list 'real x (not (null (next-method-p)))))
1267 (defgeneric test-um10 (x))
1268 (defmethod test-um10 ((x integer))
1269 (list* 'integer x (not (null (next-method-p))) (call-next-method)))
1270 (defmethod test-um10 ((x rational))
1271 (list* 'rational x (not (null (next-method-p))) (call-next-method)))
1272 (defmethod test-um10 ((x real))
1273 (list 'real x (not (null (next-method-p)))))
1274 (defmethod test-um10 :after ((x real)))
1275 (def-user-method test-um10 :around ((x integer))
1276 (list* 'around-integer x
1277 (not (null (next-method-p))) (call-next-method)))
1278 (defmethod test-um10 :around ((x rational))
1279 (list* 'around-rational x
1280 (not (null (next-method-p))) (call-next-method)))
1281 (defmethod test-um10 :around ((x real))
1282 (list* 'around-real x (not (null (next-method-p))) (call-next-method)))
1284 fails with a type error, and
1287 (defgeneric test-um12 (x))
1288 (defmethod test-um12 ((x integer))
1289 (list* 'integer x (not (null (next-method-p))) (call-next-method)))
1290 (defmethod test-um12 ((x rational))
1291 (list* 'rational x (not (null (next-method-p))) (call-next-method)))
1292 (defmethod test-um12 ((x real))
1293 (list 'real x (not (null (next-method-p)))))
1294 (defmethod test-um12 :after ((x real)))
1295 (defmethod test-um12 :around ((x integer))
1296 (list* 'around-integer x
1297 (not (null (next-method-p))) (call-next-method)))
1298 (defmethod test-um12 :around ((x rational))
1299 (list* 'around-rational x
1300 (not (null (next-method-p))) (call-next-method)))
1301 (def-user-method test-um12 :around ((x real))
1302 (list* 'around-real x (not (null (next-method-p))) (call-next-method)))
1304 fails with NO-APPLICABLE-METHOD.
1306 339: "DEFINE-METHOD-COMBINATION bugs"
1307 (reported by Bruno Haible via the clisp test suite)
1309 a. Syntax checking laxity (should produce errors):
1310 i. (define-method-combination foo :documentation :operator)
1311 ii. (define-method-combination foo :documentation nil)
1312 iii. (define-method-combination foo nil)
1313 iv. (define-method-combination foo nil nil
1314 (:arguments order &aux &key))
1315 v. (define-method-combination foo nil nil (:arguments &whole))
1316 vi. (define-method-combination foo nil nil (:generic-function))
1317 vii. (define-method-combination foo nil nil (:generic-function bar baz))
1318 viii. (define-method-combination foo nil nil (:generic-function (bar)))
1319 ix. (define-method-combination foo nil ((3)))
1320 x. (define-method-combination foo nil ((a)))
1322 b. define-method-combination arguments lambda list badness
1323 i. &aux args are currently unsupported;
1324 ii. default values of &optional and &key arguments are ignored;
1325 iii. supplied-p variables for &optional and &key arguments are not
1328 c. qualifier matching incorrect
1330 (define-method-combination mc27 ()
1332 (ignored (:ignore :unused)))
1334 ,@(mapcar #'(lambda (method) `(call-method ,method)) normal)))
1335 (defgeneric test-mc27 (x)
1336 (:method-combination mc27)
1337 (:method :ignore ((x number)) (/ 0)))
1340 should signal an invalid-method-error, as the :IGNORE (NUMBER)
1341 method is applicable, and yet matches neither of the method group
1344 343: MOP:COMPUTE-DISCRIMINATING-FUNCTION overriding causes error
1345 Even the simplest possible overriding of
1346 COMPUTE-DISCRIMINATING-FUNCTION, suggested in the PCL implementation
1347 as "canonical", does not work:
1348 (defclass my-generic-function (standard-generic-function) ()
1349 (:metaclass funcallable-standard-class))
1350 (defmethod compute-discriminating-function ((gf my-generic-function))
1351 (let ((dfun (call-next-method)))
1352 (lambda (&rest args)
1353 (apply dfun args))))
1355 (:generic-function-class my-generic-function))
1356 (defmethod foo (x) (+ x x))
1358 signals an error. This error is the same even if the LAMBDA is
1359 replaced by (FUNCTION (SB-KERNEL:INSTANCE-LAMBDA ...)). Maybe the
1360 SET-FUNCALLABLE-INSTANCE-FUN scary stuff in
1361 src/code/target-defstruct.lisp is broken? This seems to be broken
1362 in CMUCL 18e, so it's not caused by a recent change.
1364 344: more (?) ROOM T problems (possibly part of bug 108)
1365 In sbcl-0.8.12.51, and off and on leading up to it, the
1366 SB!VM:MEMORY-USAGE operations in ROOM T caused
1367 unhandled condition (of type SB-INT:BUG):
1368 failed AVER: "(SAP= CURRENT END)"
1369 Several clever people have taken a shot at this without fixing
1370 it; this time around (before sbcl-0.8.13 release) I (WHN) just
1371 commented out the SB!VM:MEMORY-USAGE calls until someone figures
1372 out how to make them work reliably with the rest of the GC.
1374 (Note: there's at least one dubious thing in room.lisp: see the
1375 comment in VALID-OBJ)
1377 346: alpha backtrace
1378 In sbcl-0.8.13, all backtraces from errors caused by internal errors
1379 on the alpha seem to have a "bogus stack frame".
1381 349: PPRINT-INDENT rounding implementation decisions
1382 At present, pprint-indent (and indeed the whole pretty printer)
1383 more-or-less assumes that it's using a monospace font. That's
1384 probably not too silly an assumption, but one piece of information
1385 the current implementation loses is from requests to indent by a
1386 non-integral amount. As of sbcl-0.8.15.9, the system silently
1387 truncates the indentation to an integer at the point of request, but
1388 maybe the non-integral value should be propagated through the
1389 pprinter and only truncated at output? (So that indenting by 1/2
1390 then 3/2 would indent by two spaces, not one?)
1392 352: forward-referenced-class trouble
1393 reported by Bruno Haible on sbcl-devel
1395 (setf (class-name (find-class 'a)) 'b)
1399 Expected: an instance of c, with a slot named x
1400 Got: debugger invoked on a SIMPLE-ERROR in thread 78906:
1401 While computing the class precedence list of the class named C.
1402 The class named B is a forward referenced class.
1403 The class named B is a direct superclass of the class named C.
1405 353: debugger suboptimalities on x86
1406 On x86 backtraces for undefined functions start with a bogus stack
1407 frame, and backtraces for throws to unknown catch tags with a "no
1408 debug information" frame. These are both due to CODE-COMPONENT-FROM-BITS
1409 (used on non-x86 platforms) being a more complete solution then what
1412 On x86/linux large portions of tests/debug.impure.lisp have been commented
1413 out as failures. The probable culprit for these problems is in x86-call-context
1414 (things work fine on x86/freebsd).
1416 More generally, the debugger internals suffer from excessive x86/non-x86
1417 conditionalization and OAOOMization: refactoring the common parts would
1420 354: XEPs in backtraces
1421 Under default compilation policy
1425 Has the XEP for TEST in the backtrace, not the TEST frame itself.
1426 (sparc and x86 at least)
1428 Since SBCL 0.8.20.1 this is hidden unless *SHOW-ENTRY-POINT-DETAILS*
1429 is true (instead there appear two TEST frames at least on ppc). The
1430 underlying cause seems to be that SB-C::TAIL-ANNOTATE will not merge
1431 the tail-call for the XEP, since Python has by that time proved that
1432 the function can never return; same happens if the function holds an
1433 unconditional call to ERROR.
1435 355: change-class of generic-function
1436 (reported by Bruno Haible)
1437 The MOP doesn't support change-class on a generic-function. However, SBCL
1438 apparently supports it, since it doesn't give an error or warning when doing
1439 so so. Then, however, it produces wrong results for calls to this generic
1441 ;;; The effective-methods cache:
1443 (defgeneric testgf35 (x))
1444 (defmethod testgf35 ((x integer))
1445 (cons 'integer (if (next-method-p) (call-next-method))))
1446 (defmethod testgf35 ((x real))
1447 (cons 'real (if (next-method-p) (call-next-method))))
1448 (defclass customized5-generic-function (standard-generic-function)
1450 (:metaclass sb-pcl:funcallable-standard-class))
1451 (defmethod sb-pcl:compute-effective-method ((gf customized5-generic-function) method-combination methods)
1452 `(REVERSE ,(call-next-method)))
1456 (change-class #'testgf35 'customized5-generic-function)
1458 Expected: ((INTEGER REAL) (REAL INTEGER))
1459 Got: ((INTEGER REAL) (INTEGER REAL))
1460 ;;; The discriminating-function cache:
1462 (defgeneric testgf36 (x))
1463 (defmethod testgf36 ((x integer))
1464 (cons 'integer (if (next-method-p) (call-next-method))))
1465 (defmethod testgf36 ((x real))
1466 (cons 'real (if (next-method-p) (call-next-method))))
1467 (defclass customized6-generic-function (standard-generic-function)
1469 (:metaclass sb-pcl:funcallable-standard-class))
1470 (defmethod sb-pcl:compute-discriminating-function ((gf customized6-generic-function))
1471 (let ((orig-df (call-next-method)))
1472 #'(lambda (&rest arguments)
1473 (reverse (apply orig-df arguments)))))
1477 (change-class #'testgf36 'customized6-generic-function)
1479 Expected: ((INTEGER REAL) (REAL INTEGER))
1480 Got: ((INTEGER REAL) (INTEGER REAL))
1483 (reported by Bruno Haible)
1484 After the "layout depth conflict" error, the CLOS is left in a state where
1485 it's not possible to define new standard-class subclasses any more.
1487 (defclass prioritized-dispatcher ()
1488 ((dependents :type list :initform nil)))
1489 (defmethod sb-pcl:validate-superclass ((c1 sb-pcl:funcallable-standard-class)
1490 (c2 (eql (find-class 'prioritized-dispatcher))))
1492 (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
1494 (:metaclass sb-pcl:funcallable-standard-class))
1495 ;; ERROR, Quit the debugger with ABORT
1496 (defclass typechecking-reader-class (standard-class)
1498 Expected: #<STANDARD-CLASS TYPECHECKING-READER-CLASS>
1499 Got: ERROR "The assertion SB-PCL::WRAPPERS failed."
1501 357: defstruct inheritance of initforms
1502 (reported by Bruno Haible)
1503 When defstruct and defclass (with :metaclass structure-class) are mixed,
1504 1. some slot initforms are ignored by the DEFSTRUCT generated constructor
1506 2. all slot initforms are ignored by MAKE-INSTANCE. (This can be arguably
1507 OK for initforms that were given in a DEFSTRUCT form, but for those
1508 given in a DEFCLASS form, I think it qualifies as a bug.)
1510 (defstruct structure02a
1514 (defclass structure02b (structure02a)
1515 ((slot4 :initform -44)
1518 (slot7 :initform (floor (* pi pi)))
1519 (slot8 :initform 88))
1520 (:metaclass structure-class))
1521 (defstruct (structure02c (:include structure02b (slot8 -88)))
1524 (slot11 (floor (exp 3))))
1526 (let ((a (make-structure02c)))
1527 (list (structure02c-slot4 a)
1528 (structure02c-slot5 a)
1529 (structure02c-slot6 a)
1530 (structure02c-slot7 a)))
1531 Expected: (-44 nil t 9)
1532 Got: (SB-PCL::..SLOT-UNBOUND.. SB-PCL::..SLOT-UNBOUND..
1533 SB-PCL::..SLOT-UNBOUND.. SB-PCL::..SLOT-UNBOUND..)
1535 (let ((b (make-instance 'structure02c)))
1536 (list (structure02c-slot2 b)
1537 (structure02c-slot3 b)
1538 (structure02c-slot4 b)
1539 (structure02c-slot6 b)
1540 (structure02c-slot7 b)
1541 (structure02c-slot8 b)
1542 (structure02c-slot10 b)
1543 (structure02c-slot11 b)))
1544 Expected: (t 3 -44 t 9 -88 t 20)
1545 Got: (0 0 0 0 0 0 0 0)
1547 358: :DECLARE argument to ENSURE-GENERIC-FUNCTION
1548 (reported by Bruno Haible)
1549 According to ANSI CL, ensure-generic-function must accept a :DECLARE
1550 keyword argument. In SBCL 0.8.16 it does not.
1553 (ensure-generic-function 'foo113 :declare '((optimize (speed 3))))
1554 (sb-pcl:generic-function-declarations #'foo113))
1555 Expected: ((OPTIMIZE (SPEED 3)))
1557 Invalid initialization argument:
1559 in call for class #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>.
1561 The ANSI Standard, Section 7.1.2
1563 Bruno notes: The MOP specifies that ensure-generic-function accepts :DECLARATIONS.
1564 The easiest way to be compliant to both specs is to accept both (exclusively
1567 359: wrong default value for ensure-generic-function's :generic-function-class argument
1568 (reported by Bruno Haible)
1569 ANSI CL is silent on this, but the MOP's specification of ENSURE-GENERIC-FUNCTION says:
1570 "The remaining arguments are the complete set of keyword arguments
1571 received by ENSURE-GENERIC-FUNCTION."
1572 and the spec of ENSURE-GENERIC-FUNCTION-USING-CLASS:
1573 ":GENERIC-FUNCTION-CLASS - a class metaobject or a class name. If it is not
1574 supplied, it defaults to the class named STANDARD-GENERIC-FUNCTION."
1575 This is not the case in SBCL. Test case:
1576 (defclass my-generic-function (standard-generic-function)
1578 (:metaclass sb-pcl:funcallable-standard-class))
1579 (setf (fdefinition 'foo1)
1580 (make-instance 'my-generic-function :name 'foo1))
1581 (ensure-generic-function 'foo1
1582 :generic-function-class (find-class 'standard-generic-function))
1584 ; => #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
1585 (setf (fdefinition 'foo2)
1586 (make-instance 'my-generic-function :name 'foo2))
1587 (ensure-generic-function 'foo2)
1589 Expected: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS STANDARD-GENERIC-FUNCTION>
1590 Got: #<SB-MOP:FUNCALLABLE-STANDARD-CLASS MY-GENERIC-FUNCTION>
1592 360: CALL-METHOD not recognized in method-combination body
1593 (reported by Bruno Haible)
1594 This method combination, which adds 'redo' and 'return' restarts for each
1595 method invocation to standard method combination, gives an error in SBCL.
1596 (defun prompt-for-new-values ()
1597 (format *debug-io* "~&New values: ")
1598 (list (read *debug-io*)))
1599 (defun add-method-restarts (form method)
1600 (let ((block (gensym))
1608 :REPORT (LAMBDA (STREAM) (FORMAT STREAM "Try calling ~S again." ,method))
1611 :REPORT (LAMBDA (STREAM) (FORMAT STREAM "Specify return values for ~S call." ,method))
1612 :INTERACTIVE (LAMBDA () (PROMPT-FOR-NEW-VALUES))
1613 (RETURN-FROM ,block (VALUES-LIST L)))))))))
1614 (defun convert-effective-method (efm)
1616 (if (eq (car efm) 'CALL-METHOD)
1617 (let ((method-list (third efm)))
1618 (if (or (typep (first method-list) 'method) (rest method-list))
1619 ; Reduce the case of multiple methods to a single one.
1620 ; Make the call to the next-method explicit.
1621 (convert-effective-method
1622 `(CALL-METHOD ,(second efm)
1624 (CALL-METHOD ,(first method-list) ,(rest method-list))))))
1625 ; Now the case of at most one method.
1626 (if (typep (second efm) 'method)
1627 ; Wrap the method call in a RESTART-CASE.
1628 (add-method-restarts
1629 (cons (convert-effective-method (car efm))
1630 (convert-effective-method (cdr efm)))
1632 ; Normal recursive processing.
1633 (cons (convert-effective-method (car efm))
1634 (convert-effective-method (cdr efm))))))
1635 (cons (convert-effective-method (car efm))
1636 (convert-effective-method (cdr efm))))
1638 (define-method-combination standard-with-restarts ()
1641 (primary () :required t)
1643 (flet ((call-methods-sequentially (methods)
1644 (mapcar #'(lambda (method)
1645 `(CALL-METHOD ,method))
1647 (let ((form (if (or before after (rest primary))
1648 `(MULTIPLE-VALUE-PROG1
1650 ,@(call-methods-sequentially before)
1651 (CALL-METHOD ,(first primary) ,(rest primary)))
1652 ,@(call-methods-sequentially (reverse after)))
1653 `(CALL-METHOD ,(first primary)))))
1656 `(CALL-METHOD ,(first around)
1657 (,@(rest around) (MAKE-METHOD ,form)))))
1658 (convert-effective-method form))))
1659 (defgeneric testgf16 (x) (:method-combination standard-with-restarts))
1660 (defclass testclass16a () ())
1661 (defclass testclass16b (testclass16a) ())
1662 (defclass testclass16c (testclass16a) ())
1663 (defclass testclass16d (testclass16b testclass16c) ())
1664 (defmethod testgf16 ((x testclass16a))
1666 (not (null (find-restart 'method-redo)))
1667 (not (null (find-restart 'method-return)))))
1668 (defmethod testgf16 ((x testclass16b))
1669 (cons 'b (call-next-method)))
1670 (defmethod testgf16 ((x testclass16c))
1671 (cons 'c (call-next-method)))
1672 (defmethod testgf16 ((x testclass16d))
1673 (cons 'd (call-next-method)))
1674 (testgf16 (make-instance 'testclass16d))
1676 Expected: (D B C A T T)
1677 Got: ERROR CALL-METHOD outside of a effective method form
1679 This is a bug because ANSI CL HyperSpec/Body/locmac_call-m__make-method
1681 "The macro call-method invokes the specified method, supplying it with
1682 arguments and with definitions for call-next-method and for next-method-p.
1683 If the invocation of call-method is lexically inside of a make-method,
1684 the arguments are those that were supplied to that method. Otherwise
1685 the arguments are those that were supplied to the generic function."
1686 and the example uses nothing more than these two cases (as you can see by
1687 doing (trace convert-effective-method)).
1689 361: initialize-instance of standard-reader-method ignores :function argument
1690 (reported by Bruno Haible)
1691 Pass a custom :function argument to initialize-instance of a
1692 standard-reader-method instance, but it has no effect.
1693 ;; Check that it's possible to define reader methods that do typechecking.
1695 (defclass typechecking-reader-method (sb-pcl:standard-reader-method)
1697 (defmethod initialize-instance ((method typechecking-reader-method) &rest initargs
1698 &key slot-definition)
1699 (let ((name (sb-pcl:slot-definition-name slot-definition))
1700 (type (sb-pcl:slot-definition-type slot-definition)))
1701 (apply #'call-next-method method
1702 :function #'(lambda (args next-methods)
1703 (declare (ignore next-methods))
1704 (apply #'(lambda (instance)
1705 (let ((value (slot-value instance name)))
1706 (unless (typep value type)
1707 (error "Slot ~S of ~S is not of type ~S: ~S"
1708 name instance type value))
1712 (defclass typechecking-reader-class (standard-class)
1714 (defmethod sb-pcl:validate-superclass ((c1 typechecking-reader-class) (c2 standard-class))
1716 (defmethod reader-method-class ((class typechecking-reader-class) direct-slot &rest args)
1717 (find-class 'typechecking-reader-method))
1718 (defclass testclass25 ()
1719 ((pair :type (cons symbol (cons symbol null)) :initarg :pair :accessor testclass25-pair))
1720 (:metaclass typechecking-reader-class))
1721 (macrolet ((succeeds (form)
1722 `(not (nth-value 1 (ignore-errors ,form)))))
1723 (let ((p (list 'abc 'def))
1724 (x (make-instance 'testclass25)))
1725 (list (succeeds (make-instance 'testclass25 :pair '(seventeen 17)))
1726 (succeeds (setf (testclass25-pair x) p))
1727 (succeeds (setf (second p) 456))
1728 (succeeds (testclass25-pair x))
1729 (succeeds (slot-value x 'pair))))))
1730 Expected: (t t t nil t)
1733 (inspect (first (sb-pcl:generic-function-methods #'testclass25-pair)))
1734 shows that the method was created with a FAST-FUNCTION slot but with a
1735 FUNCTION slot of NIL.
1737 362: missing error when a slot-definition is created without a name
1738 (reported by Bruno Haible)
1739 The MOP says about slot-definition initialization:
1740 "The :NAME argument is a slot name. An ERROR is SIGNALled if this argument
1741 is not a symbol which can be used as a variable name. An ERROR is SIGNALled
1742 if this argument is not supplied."
1744 (make-instance (find-class 'sb-pcl:standard-direct-slot-definition))
1746 Got: #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION NIL>
1748 363: missing error when a slot-definition is created with a wrong documentation object
1749 (reported by Bruno Haible)
1750 The MOP says about slot-definition initialization:
1751 "The :DOCUMENTATION argument is a STRING or NIL. An ERROR is SIGNALled
1752 if it is not. This argument default to NIL during initialization."
1754 (make-instance (find-class 'sb-pcl:standard-direct-slot-definition)
1756 :documentation 'not-a-string)
1758 Got: #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION FOO>
1760 364: does not support class objects as specializer names
1761 (reported by Bruno Haible)
1762 According to ANSI CL 7.6.2, class objects are valid specializer names,
1763 and "Parameter specializer names are used in macros intended as the
1764 user-level interface (defmethod)". DEFMETHOD's syntax section doesn't
1765 mention this possibility in the BNF for parameter-specializer-name;
1766 however, this appears to be an editorial omission, since the CLHS
1767 mentions issue CLASS-OBJECT-SPECIALIZER:AFFIRM as being approved
1768 by X3J13. SBCL doesn't support it:
1769 (defclass foo () ())
1770 (defmethod goo ((x #.(find-class 'foo))) x)
1771 Expected: #<STANDARD-METHOD GOO (#<STANDARD-CLASS FOO>)>
1772 Got: ERROR "#<STANDARD-CLASS FOO> is not a legal class name."
1774 365: mixin on generic-function subclass
1775 (reported by Bruno Haible)
1777 (defclass prioritized-dispatcher ()
1778 ((dependents :type list :initform nil)))
1779 on a generic-function subclass:
1780 (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
1782 (:metaclass sb-pcl:funcallable-standard-class))
1783 SBCL gives an error on this, telling to define a method on SB-MOP:VALIDATE-SUPERCLASS. If done,
1784 (defmethod sb-pcl:validate-superclass ((c1 sb-pcl:funcallable-standard-class)
1785 (c2 (eql (find-class 'prioritized-dispatcher))))
1788 (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
1790 (:metaclass sb-pcl:funcallable-standard-class))
1791 => debugger invoked on a SIMPLE-ERROR in thread 6687:
1792 layout depth conflict: #(#<SB-KERNEL:LAYOUT for T {500E1E9}> ...)
1794 Further discussion on this: http://thread.gmane.org/gmane.lisp.steel-bank.general/491
1796 366: cannot define two generic functions with user-defined class
1797 (reported by Bruno Haible)
1798 it is possible to define one generic function class and an instance
1799 of it. But attempting to do the same thing again, in the same session,
1800 leads to a "Control stack exhausted" error. Test case:
1801 (defclass my-generic-function-1 (standard-generic-function)
1803 (:metaclass sb-pcl:funcallable-standard-class))
1804 (defgeneric testgf-1 (x) (:generic-function-class my-generic-function-1)
1805 (:method ((x integer)) (cons 'integer nil)))
1806 (defclass my-generic-function-2 (standard-generic-function)
1808 (:metaclass sb-pcl:funcallable-standard-class))
1809 (defgeneric testgf-2 (x) (:generic-function-class my-generic-function-2)
1810 (:method ((x integer)) (cons 'integer nil)))
1811 => SB-KERNEL::CONTROL-STACK-EXHAUSTED
1813 367: TYPE-ERROR at compile time, undetected TYPE-ERROR at runtime
1815 (declaim (optimize (safety 3) (debug 2) (speed 2) (space 1)))
1819 (i367s (make-array 0 :fill-pointer t) :type (or (vector i367) null)))
1821 (g367 (error "missing :G367") :type g367 :read-only t))
1822 ;;; In sbcl-0.8.18, commenting out this (DECLAIM (FTYPE ... R367))
1823 ;;; gives an internal error at compile time:
1824 ;;; The value #<SB-KERNEL:NAMED-TYPE NIL> is not of
1825 ;;; type SB-KERNEL:VALUES-TYPE.
1826 (declaim (ftype (function ((vector i367) e367) (or s367 null)) r367))
1827 (declaim (ftype (function ((vector e367)) (values)) h367))
1829 (let ((x (g367-i367s (make-g367))))
1830 (let* ((y (or (r367 x w)
1833 (format t "~&Y=~S Z=~S~%" y z)
1835 (defun r367 (x y) (declare (ignore x y)) nil)
1836 (defun h367 (x) (declare (ignore x)) (values))
1837 ;;; In sbcl-0.8.18, executing this form causes an low-level error
1838 ;;; segmentation violation at #X9B0E1F4
1839 ;;; (instead of the TYPE-ERROR that one might like).
1840 (frob 0 (make-e367))
1841 can be made to cause two different problems, as noted in the comments:
1842 bug 367a: Compile and load the file. No TYPE-ERROR is signalled at
1843 run time (in the (S367-G367 Y) form of FROB, when Y is NIL
1844 instead of an instance of S367). Instead (on x86/Linux at least)
1845 we end up with a segfault.
1846 bug 367b: Comment out the (DECLAIM (FTYPE ... R367)), and compile
1847 the file. The compiler fails with TYPE-ERROR at compile time.
1849 368: miscompiled OR (perhaps related to bug 367)
1850 Trying to relax type declarations to find a workaround for bug 367,
1851 it turns out that even when the return type isn't declared (or
1852 declared to be T, anyway) the system remains confused about type
1853 inference in code similar to that for bug 367:
1854 (in-package :cl-user)
1855 (declaim (optimize (safety 3) (debug 2) (speed 2) (space 1)))
1859 (i368s (make-array 0 :fill-pointer t) :type (or (vector i368) null)))
1861 (g368 (error "missing :G368") :type g368 :read-only t))
1862 (declaim (ftype (function (fixnum (vector i368) e368) t) r368))
1863 (declaim (ftype (function (fixnum (vector e368)) t) h368))
1864 (defparameter *h368-was-called-p* nil)
1865 (defun nsu (vertices e368)
1866 (let ((i368s (g368-i368s (make-g368))))
1867 (let ((fuis (r368 0 i368s e368)))
1868 (format t "~&FUIS=~S~%" fuis)
1869 (or fuis (h368 0 i368s)))))
1871 (declare (ignore w x y))
1874 (declare (ignore w x))
1875 (setf *h368-was-called-p* t)
1876 (make-s368 :g368 (make-g368)))
1878 (format t "~&calling NSU~%")
1879 (let ((nsu (nsu #() (make-e368))))
1880 (format t "~&NSU returned ~S~%" nsu)
1881 (format t "~&*H368-WAS-CALLED-P*=~S~%" *h368-was-called-p*)
1882 (assert (s368-p nsu))
1883 (assert *h368-was-called-p*))
1884 In sbcl-0.8.18, both ASSERTs fail, and (DISASSEMBLE 'NSU) shows
1885 that no call to H368 is compiled.
1887 369: unlike-an-intersection behavior of VALUES-TYPE-INTERSECTION
1888 In sbcl-0.8.18.2, the identity $(x \cap y \cap y)=(x \cap y)$
1889 does not hold for VALUES-TYPE-INTERSECTION, even for types which
1890 can be intersected exactly, so that ASSERTs fail in this test case:
1891 (in-package :cl-user)
1892 (let ((types (mapcar #'sb-c::values-specifier-type
1893 '((values (vector package) &optional)
1894 (values (vector package) &rest t)
1895 (values (vector hash-table) &rest t)
1896 (values (vector hash-table) &optional)
1897 (values t &optional)
1899 (values nil &optional)
1900 (values nil &rest t)
1901 (values sequence &optional)
1902 (values sequence &rest t)
1903 (values list &optional)
1904 (values list &rest t)))))
1907 (let ((i (sb-c::values-type-intersection x y)))
1908 (assert (sb-c::type= i (sb-c::values-type-intersection i x)))
1909 (assert (sb-c::type= i (sb-c::values-type-intersection i y)))))))
1911 370: reader misbehaviour on large-exponent floats
1912 (read-from-string "1.0s1000000000000000000000000000000000000000")
1913 causes the reader to attempt to create a very large bignum (which it
1914 will then attempt to coerce to a rational). While this isn't
1915 completely wrong, it is probably not ideal -- checking the floating
1916 point control word state and then returning the relevant float
1917 (most-positive-short-float or short-float-infinity) or signalling an
1918 error immediately would seem to make more sense.
1920 372: floating-point overflow not signalled on ppc/darwin
1921 The following assertions in float.pure.lisp fail on ppc/darwin
1922 (Mac OS X version 10.3.7):
1923 (assert (raises-error? (scale-float 1.0 most-positive-fixnum)
1924 floating-point-overflow))
1925 (assert (raises-error? (scale-float 1.0d0 (1+ most-positive-fixnum))
1926 floating-point-overflow)))
1927 as the SCALE-FLOAT just returns
1928 #.SB-EXT:SINGLE/DOUBLE-FLOAT-POSITIVE-INFINITY. These tests have been
1929 disabled on Darwin for now.
1931 377: Memory fault error reporting
1932 On those architectures where :C-STACK-IS-CONTROL-STACK is in
1933 *FEATURES*, we handle SIG_MEMORY_FAULT (SEGV or BUS) on an altstack,
1934 so we cannot handle the signal directly (as in interrupt_handle_now())
1935 in the case when the signal comes from some external agent (the user
1936 using kill(1), or a fault in some foreign code, for instance). As
1937 of sbcl-0.8.20.20, this is fixed by calling
1938 arrange_return_to_lisp_function() to a new error-signalling
1939 function, but as a result the error reporting is poor: we cannot
1940 even tell the user at which address the fault occurred. We should
1941 arrange such that arguments can be passed to the function called from
1942 arrange_return_to_lisp_function(), but this looked hard to do in
1943 general without suffering from memory leaks.
1945 379: TRACE :ENCAPSULATE NIL broken on ppc/darwin
1946 See commented-out test-case in debug.impure.lisp.
1948 380: Accessor redefinition fails because of old accessor name
1949 When redefining an accessor, SB-PCL::FIX-SLOT-ACCESSORS may try to
1950 find the generic function named by the old accessor name using
1951 ENSURE-GENERIC-FUNCTION and then remove the old accessor's method in
1952 the GF. If the old name does not name a function, or if the old name
1953 does not name a generic function, no attempt to find the GF or remove
1954 any methods is made.
1956 However, if an unrelated GF with an incompatible lambda list exists,
1957 the class redefinition will fail when SB-PCL::REMOVE-READER-METHOD
1958 tries to find and remove a method with an incompatible lambda list
1959 from the unrelated generic function.
1961 381: incautious calls to EQUAL in fasl dumping
1963 (frob #(#1=(a #1#)))
1964 (frob #(#1=(b #1#)))
1965 (frob #(#1=(a #1#)))
1966 in sbcl-0.9.0 causes CONTROL-STACK-EXHAUSTED. My (WHN) impression
1967 is that this follows from the use of (MAKE-HASH-TABLE :TEST 'EQUAL)
1968 to detect sharing, in which case fixing it might require either
1969 getting less ambitious about detecting shared list structure, or
1970 implementing the moral equivalent of EQUAL hash tables in a
1973 382: externalization unexpectedly changes array simplicity
1974 COMPILE-FILE and LOAD
1976 (let ((x #.(make-array 4 :fill-pointer 0)))
1977 (values (eval `(typep ',x 'simple-array))
1978 (typep x 'simple-array))))
1979 then (FOO) => T, NIL.
1981 Similar problems exist with SIMPLE-ARRAY-P, ARRAY-HEADER accessors
1982 and all array dimension functions.
1984 383: ASH'ing non-constant zeros
1987 (declare (type (integer -2 14) b))
1988 (declare (ignorable b))
1989 (ash (imagpart b) 57))
1990 on PPC (and other platforms, presumably) gives an error during the
1991 emission of FASH-ASH-LEFT/FIXNUM=>FIXNUM as the assembler attempts to
1992 stuff a too-large constant into the immediate field of a PPC
1993 instruction. Either the VOP should be fixed or the compiler should be
1994 taught how to transform this case away, paying particular attention
1995 to side-effects that might occur in the arguments to ASH.
1997 384: Compiler runaway on very large character types
1999 (compile nil '(lambda (x)
2000 (declare (type (member #\a 1) x))
2001 (the (member 1 nil) x)))
2003 The types apparently normalize into a very large type, and the compiler
2004 gets lost in REMOVE-DUPLICATES. Perhaps the latter should use
2005 a better algorithm (one based on hash tables, say) on very long lists
2006 when :TEST has its default value?
2010 (compile nil '(lambda (x) (the (not (eql #\a)) x)))
2012 (partially fixed in 0.9.3.1, but a better representation for these
2016 (format nil "~4,1F" 0.001) => "0.00" (should be " 0.0");
2017 (format nil "~4,1@F" 0.001) => "+.00" (should be "+0.0").
2019 386: SunOS/x86 stack exhaustion handling broken
2020 According to <http://alfa.s145.xrea.com/sbcl/solaris-x86.html>, the
2021 stack exhaustion checking (implemented with a write-protected guard
2022 page) does not work on SunOS/x86.
2025 12:10 < jsnell> the package-lock test is basically due to a change in the test
2026 behaviour when you install a handler for error around it. I
2027 thought I'd disabled the test for now, but apparently that was
2029 12:19 < Xophe> jsnell: ah, I see the problem in the package-locks stuff
2030 12:19 < Xophe> it's the same problem as we had with compiler-error conditions
2031 12:19 < Xophe> the thing that's signalled up and down the stack is a subtype of
2032 ERROR, where it probably shouldn't be
2035 (found by Dmitry Bogomolov)
2037 (defclass foo () ((x :type (unsigned-byte 8))))
2038 (defclass bar () ((x :type symbol)))
2039 (defclass baz (foo bar) ())
2043 SB-PCL::SPECIALIZER-APPLICABLE-USING-TYPE-P cannot handle the second argument
2047 (reported several times on sbcl-devel, by Rick Taube, Brian Rowe and
2050 ROUND-NUMERIC-BOUND assumes that float types always have a FORMAT
2051 specifying whether they're SINGLE or DOUBLE. This is true for types
2052 computed by the type system itself, but the compiler type derivation
2053 short-circuits this and constructs non-canonical types. A temporary
2054 fix was made to ROUND-NUMERIC-BOUND for the sbcl-0.9.6 release, but
2055 the right fix is to remove the abstraction violation in the
2056 compiler's type deriver.
2058 393: Wrong error from methodless generic function
2059 (DEFGENERIC FOO (X))
2061 gives NO-APPLICABLE-METHOD rather than an argument count error.
2063 394: (SETF CLASS-NAME)/REINITIALIZE-INSTANCE bug
2064 (found by PFD ansi-tests)
2065 in sbcl-0.9.7.15, (SETF (CLASS-NAME <class>) 'NIL) causes
2066 (FIND-CLASS NIL) to return a #<STANDARD-CLASS NIL>.
2068 395: Unicode and streams
2069 One of the remaining problems in SBCL's Unicode support is the lack
2070 of generality in certain streams.
2071 a. FILL-POINTER-STREAMs: SBCL refuses to write (e.g. using FORMAT)
2072 to streams made from strings that aren't character strings with
2074 (let ((v (make-array 5 :fill-pointer 0 :element-type 'standard-char)))
2077 should return a non-simple base string containing "foo" but
2080 (reported on sbcl-help by "tichy")
2082 396: block-compilation bug
2086 (when (funcall (eval #'(lambda (x) (eql x 2))) y)
2088 (incf x (incf y z))))))
2092 (bar 1) => 11, should be 4.
2095 The more interrupts arrive the less accurate SLEEP's timing gets.
2096 (time (sb-thread:terminate-thread
2097 (prog1 (sb-thread:make-thread (lambda ()
2104 398: GC-unsafe SB-ALIEN string deporting
2105 Translating a Lisp string to an alien string by taking a SAP to it
2106 as done by the :DEPORT-GEN methods for C-STRING and UTF8-STRING
2107 is not safe, since the Lisp string can move. For example the
2108 following code will fail quickly on both cheneygc and pre-0.9.8.19
2111 (setf (bytes-consed-between-gcs) 4096)
2112 (define-alien-routine "strcmp" int (s1 c-string) (s2 c-string))
2115 (let ((string "hello, world"))
2116 (assert (zerop (strcmp string string)))))
2118 (This will appear to work on post-0.9.8.19 GENCGC, since
2119 the GC no longer zeroes memory immediately after releasing
2120 it after a minor GC. Either enabling the READ_PROTECT_FREE_PAGES
2121 #define in gencgc.c or modifying the example so that a major
2122 GC will occasionally be triggered would unmask the bug.)
2124 On cheneygc the only solution would seem to be allocating some alien
2125 memory, copying the data over, and arranging that it's freed once we
2126 return. For GENCGC we could instead try to arrange that the string
2127 from which the SAP is taken is always pinned.
2129 For some more details see comments for (define-alien-type-method
2130 (c-string :deport-gen) ...) in host-c-call.lisp.
2132 401: "optimizer runaway on bad constant type specifiers in TYPEP"
2133 (fixed in 0.9.12.12)