I believe that bug 110 could be described as not a bug, as in fact it
corresponds precisely to the CMUCL documentation about
weakened type checking; tracing sb-c:maybe-weaken-check while compiling
that function under policies with (speed 1) (safety 1) and (speed 3)
(safety 2) indicate that it's doing exactly what the CMUCL manual says
it will do (section 4.5.3, "weakened type checking").
That said, there are two opportunities for thought here. One is that we
need to think about what we want the various policy bits to correspond
to in terms of code generation; this is a matter for global (pardon me)
policy. The other is that we are missing, in maybe-weaken-type, the
opportunity to weaken union-type tests by a certain amount without
flushing them altogether (something like the attached patch, which I
haven't tried to build with but which if pasted into a running sbcl does
the right thing with the example in the bug).
Note that even with the patch we won't catch all errors; for instance,
* (defstruct foo)
* (tst (make-foo))
after patching maybe-weaken-check will give STREAM as output; this is
because the stream type test has been weakened to a test for an
INSTANCE, which structures pass.
Jesus College, Cambridge, CB5 8BL +44 1223 510 299
http://www-jcsu.jesus.cam.ac.uk/~csr21/ (defun pling-dollar
(str schar arg) (first (last +))) (make-dispatch-macro-character #\! t)
(set-dispatch-macro-character #\! #\$ #'pling-dollar)