diff --git a/src/builtins.c b/src/builtins.c index b627eed34f8cd2..d3e6781da336a6 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -111,6 +111,9 @@ static int NOINLINE compare_fields(const jl_value_t *a, const jl_value_t *b, jl_ if ((ptra == NULL) != (ptrb == NULL)) { return 0; } + else { + continue; + } } if (!ft->layout->haspadding) { if (!bits_equal(ao, bo, ft->size)) diff --git a/test/core.jl b/test/core.jl index 50332c1d8f6b62..b9aaea3a87a8d7 100644 --- a/test/core.jl +++ b/test/core.jl @@ -92,6 +92,14 @@ let abcd = ABCDconst(1, 2, 3, 4) @test (1, 2, "not constant", 4) === (abcd.a, abcd.b, abcd.c, abcd.d) end +# test `===` handling null pointer in struct #44712 +struct N44712 + a::Some{Any} + b::Int + AB() = new() +end + +@test unsafe_load(Ptr{N44712}(pointer(Int[0,1]))) !== unsafe_load(Ptr{N44712}(pointer(Int[0,2]))) f47(x::Vector{Vector{T}}) where {T} = 0 @test_throws MethodError f47(Vector{Vector}())