source path underlying type mismatch warning off

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

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)
        (errorp
         (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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers