source path underlying type mismatch warning off

Bug #631480 reported by Tobias C. Rittweiler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
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.

Revision history for this message
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
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.