source path underlying type mismatch warning off

Bug #631480 reported by Tobias C. Rittweiler on 2010-09-06
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

If you compile

(defun set-file-position (stream position &optional (errorp t))
  "Essentially like (FILE-POSITION STREAM POSITION) except this one
   signals an error by default if the seek does not succeed."
  (cond ((file-position stream position) position)
         (error "Could not set file-position to ~D on stream ~S."
                stream position))
        (t nil)))

(defun search-stream (pattern stream &key start end from-end buffer-size)
  (declarE (ignore from-end)) ; FIXME
  (let* ((element-type (stream-element-type stream))
         (buffer (make-array (or buffer-size 4096) :element-type element-type)))
    (let ((pos (if start (set-file-position stream start) 0)))
      (loop for n-read = (read-sequence buffer stream)
            until (zerop n-read) do
            (let* ((idx (search pattern buffer))
                   (pos* (and idx (+ pos idx))))
              (cond ((not idx) (incf pos n-read))
                    ((>= pos* end) (return nil))
                    (t (return pos*))))))))

In SLIME, the (AND IDX + POS IDX) will be highlighted, but SBCL actually
complains about the (>= POS* END) because END can be NIL.

Nikodemus Siivola (nikodemus) wrote :

Yup. To see this in action, change it to

                    ((and end (>= pos* end)) (return nil))

and see the complaint disappear.

Changed in sbcl:
importance: Undecided → Medium
status: New → Triaged
Stas Boukarev (stassats) wrote :

I don't get any notes anymore, even going back to 1.1.7

Changed in sbcl:
status: Triaged → Incomplete
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers