fix === when encountering null pointer#44749
Conversation
|
Possible to make a test for this since it is clearly something that is lacking? |
julia> struct AB
a::Some{Any}
b::Int
AB() = new()
end
julia> unsafe_load(Ptr{AB}(pointer(Int[0,1]))) === unsafe_load(Ptr{AB}(pointer(Int[0,2])))
true
julia> unsafe_load(Ptr{AB}(pointer(Int[0,1]))), unsafe_load(Ptr{AB}(pointer(Int[0,2])))
(AB(#undef, 1), AB(#undef, 2)) |
|
that's a good test, it returns |
|
Error seems unrelated |
395e11d to
c47ed76
Compare
|
I rebased it to see if that makes CI happier. |
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
|
Looks like there is still a bug here somewhere. Minimizing the error in CI a bit we get: using Base.BinaryPlatforms
using Base.Experimental
begin
Experimental.@force_compile
p1 = Platform("x86_64", "linux"; julia_version=v"1.5.0")
p2 = Platform("x86_64", "linux"; julia_version=v"1.6.0")
@show tags(p1)["julia_version"]
@show tags(p2)["julia_version"]
endIf this is run with the compilation forced it outputs: (tags(p1))["julia_version"] = "1.5.0"
(tags(p2))["julia_version"] = "1.5.0"otherwise (tags(p1))["julia_version"] = "1.5.0"
(tags(p2))["julia_version"] = "1.6.0"Breaking out the version arguments into separate variables makes the behaviour go away. |
|
Is it related to this PR somehow? |
|
Presumably in some way since it doesn't happen on e.g the master branch. |
julia> begin
Experimental.@force_compile
p2 = Platform("x86_64", "linux"; julia_version=v"1.6.0")
@show tags(p2)["julia_version"]
end
(tags(p2))["julia_version"] = "1.6.0"
"1.6.0"eh, I don't understand, feels like something to do with compilation / julia> begin
Experimental.@force_compile
p2 = Platform("x86_64", "linux"; julia_version=v"1.6.0")
p1 = Platform("x86_64", "linux"; julia_version=v"1.5.0")
@show tags(p1)["julia_version"]
@show tags(p2)["julia_version"]
end
(tags(p1))["julia_version"] = "1.6.0"
(tags(p2))["julia_version"] = "1.6.0"
"1.6.0" |
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
|
Would be nice to have a dedicated test for the latest found problem. Maybe you can cook up one more @vtjnash? |
|
I think I can cook one up today |
|
it's harder than I thought, I try to make two immutable structs both containing non-null pointers but are different, I tried something like this but it segfaults: julia> let a = Int[1, 1], b = Int[2, 1]
GC.@preserve a b begin
unsafe_load(Ptr{N44712}(pointer(a))) === unsafe_load(Ptr{N44712}(pointer(b)))
end
end |
|
neither of those contain a null pointer |
|
What you were breaking is the much more trivial case of some pointer followed by some value: (("", 0),) === (("", 1),)normally we compile this, so we don't observe often if it broke |
|
The windows test failure is unrelated (I checked the CI a bunch of other PRs test also failing) |
closes #44712