Comment 1 for bug 327223

Revision history for this message
Roman Marynchak (roman-marynchak) wrote :

CLHS says that a string should have a fill pointer in order to be an acceptable first argument to FORMAT. So, in such a case SBCL should give a compilation error, not a warning. When a string has no fill pointer, the code will fail to execute anyway, due to SB-IMPL::MAKE-FILL-POINTER-OUTPUT-STREAM call failure.

So it seems to me that the right way is to modify the FORMAT function info in file /src/compiler/fndb.lisp to be like this:

(defknown format ((or (member nil t) stream
                        (and string (satisfies array-has-fill-pointer-p)))
                  (or string function) &rest t)
  (or string null)
  (explicit-check))

Here a string as a first argument should also pass array-has-fill-pointer-p predicate. Unfortunately, such a modification breaks the cross-compilation and SBCL goes to LDB. Is SATISFIES prohibited to use with DEFKNOWN, or I have used it in a wrong way? The LDB info is:

     0: Foreign fp = 0x7ffff517c080, ra = 0x410fbf
   1: Foreign fp = 0x7ffff517c0b0, ra = 0x41471d
   2: Foreign fp = 0x7ffff517c0f0, ra = 0x41215a
   3: Foreign fp = 0x7ffff517c5a0, ra = 0x7ffff79cd080
   4: (SB!C::TL-XEP COMMON-LISP::ERROR)
   5: COMMON-LISP::FDEFINITION
   6: SB!C::CONSTANT-FUNCTION-CALL-VALUE
   7: SB!C::CONSTANT-FUNCTION-CALL-VALUE
   8: SB!C::CONSTANT-FUNCTION-CALL-P
   9: SB!KERNEL::CTYPEP

Regards,
Roman