We're updating the issue view to help you get more done. 

Off by one bug near 32^2 elements, and probably also 32^3 etc

Description

(require '[clojure.core.rrb-vector :as fv]
'[clojure.core.rrb-vector.debug :as dv])

(def v1025 (into (fv/vector) (range 1025)))

(def v1024t (persistent! (pop! (transient v1025))))
;; This shows v1024t with nothing in it but a tail. Not correct.
(dv/dbg-vec v1024t)

;; Attempting to evaluate the expression below causes a
;; NullPointerException
(= v1024t (range 1024))

;; It is not clear to me why this does not have a similar failure, but
;; I am pretty sure there is a similar bug waiting to happen in the
;; persistent version of popTail, too.
(def v1024 (pop v1025))
(dv/dbg-vec v1024)
(= v1024 (range 1024))

Environment

None

Status

Assignee

Unassigned

Reporter

Andy Fingerhut

Labels

None

Approval

None

Patch

None

Priority

Major