Skip to content

Commit 8e7384c

Browse files
committed
Make sure x in AliasGraphKeySet is in bounds
1 parent 0c6e5c9 commit 8e7384c

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
@@ -181,7 +181,10 @@ struct AliasGraphKeySet <: AbstractSet{Int}
181181
end
182182
Base.keys(ag::AliasGraph) = AliasGraphKeySet(ag)
183183
Base.iterate(agk::AliasGraphKeySet, state...) = Base.iterate(agk.ag.eliminated, state...)
184-
Base.in(i::Int, agk::AliasGraphKeySet) = agk.ag.aliasto[i] !== nothing
184+
function Base.in(i::Int, agk::AliasGraphKeySet)
185+
aliasto = agk.ag.aliasto
186+
1 <= i <= length(aliasto) && aliasto[i] !== nothing
187+
end
185188

186189
count_nonzeros(a::AbstractArray) = count(!iszero, a)
187190

0 commit comments

Comments
 (0)