Closed
Description
MWE:
struct TextKmerIterator
data::Vector{UInt8}
stop::UInt # inclusive
end
function foo(x::TextKmerIterator)
kmer, i, k = UInt(0), UInt(1), UInt(0)
@inbounds while i ≤ x.stop
byte = x.data[i]
k += one(UInt)
i += 1
kmer = ((kmer << 2) & UInt(0x3f)) | 0x01
if k == 3
return kmer, (kmer, i, k-one(UInt))
end
end
return nothing
end
And then
julia> it = TextKmerIterator(collect(codeunits("T")), 4)
Main.TextKmerIterator(UInt8[0x54], 0x0000000000000004)
julia> foo(it)
ERROR: BoundsError: attempt to access 1-element Vector{UInt8} at index [2]
According to Nicholas Bauer on Slack, the culprit is
Line 1051 in 0b55425
added in #36427 which lacks propagate inbounds.