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