Skip to content

Commit 101e475

Browse files
authored
ignore mightalias for empty objects (#51761)
There is no bytes that overlap, so it is safe to use these without needing to make an explicit copy of nothing.
1 parent 3cc4fdc commit 101e475

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ Perform a conservative test to check if arrays `A` and `B` might share the same
15071507
By default, this simply checks if either of the arrays reference the same memory
15081508
regions, as identified by their [`Base.dataids`](@ref).
15091509
"""
1510-
mightalias(A::AbstractArray, B::AbstractArray) = !isbits(A) && !isbits(B) && !_isdisjoint(dataids(A), dataids(B))
1510+
mightalias(A::AbstractArray, B::AbstractArray) = !isbits(A) && !isbits(B) && !isempty(A) && !isempty(B) && !_isdisjoint(dataids(A), dataids(B))
15111511
mightalias(x, y) = false
15121512

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

0 commit comments

Comments
 (0)