Skip to content

Commit 1d34c07

Browse files
committed
Make sure x in AliasGraphKeySet is in bounds
1 parent c3a8aed commit 1d34c07

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/systems/alias_elimination.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ struct AliasGraphKeySet <: AbstractSet{Int}
179179
end
180180
Base.keys(ag::AliasGraph) = AliasGraphKeySet(ag)
181181
Base.iterate(agk::AliasGraphKeySet, state...) = Base.iterate(agk.ag.eliminated, state...)
182-
Base.in(i::Int, agk::AliasGraphKeySet) = agk.ag.aliasto[i] !== nothing
182+
function Base.in(i::Int, agk::AliasGraphKeySet)
183+
aliasto = agk.ag.aliasto
184+
1 <= i <= length(aliasto) && aliasto[i] !== nothing
185+
end
183186

184187
count_nonzeros(a::AbstractArray) = count(!iszero, a)
185188

0 commit comments

Comments
 (0)