Skip to content

Commit

Permalink
ignore mightalias for empty objects (#51761)
Browse files Browse the repository at this point in the history
There is no bytes that overlap, so it is safe to use these without
needing to make an explicit copy of nothing.
  • Loading branch information
vtjnash authored Oct 18, 2023
1 parent 3cc4fdc commit 101e475
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ Perform a conservative test to check if arrays `A` and `B` might share the same
By default, this simply checks if either of the arrays reference the same memory
regions, as identified by their [`Base.dataids`](@ref).
"""
mightalias(A::AbstractArray, B::AbstractArray) = !isbits(A) && !isbits(B) && !_isdisjoint(dataids(A), dataids(B))
mightalias(A::AbstractArray, B::AbstractArray) = !isbits(A) && !isbits(B) && !isempty(A) && !isempty(B) && !_isdisjoint(dataids(A), dataids(B))
mightalias(x, y) = false

_isdisjoint(as::Tuple{}, bs::Tuple{}) = true
Expand Down

0 comments on commit 101e475

Please sign in to comment.