From e4c1f6c11ce44b649c02966b6e5bc0d372b0b1bc Mon Sep 17 00:00:00 2001 From: Oscar Smith Date: Fri, 31 Oct 2025 20:07:15 -0400 Subject: [PATCH 1/2] fix `pointerarith_tfunc` for Const ptr fixes https://github.com/JuliaLang/julia/issues/60009 --- Compiler/src/tfuncs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compiler/src/tfuncs.jl b/Compiler/src/tfuncs.jl index 3b4ee2b4cb676..98859efa8c87d 100644 --- a/Compiler/src/tfuncs.jl +++ b/Compiler/src/tfuncs.jl @@ -708,7 +708,7 @@ function pointer_eltype(@nospecialize(ptr)) end @nospecs function pointerarith_tfunc(𝕃::AbstractLattice, ptr, offset) - return ptr + return widenconst(ptr) end @nospecs function pointerref_tfunc(𝕃::AbstractLattice, a, i, align) return pointer_eltype(a) From 96a1670d6219bd4f2ec07103a3b105a4eb704981 Mon Sep 17 00:00:00 2001 From: Oscar Smith Date: Fri, 31 Oct 2025 20:11:45 -0400 Subject: [PATCH 2/2] add test --- Compiler/test/effects.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Compiler/test/effects.jl b/Compiler/test/effects.jl index 3d996268b77ed..cbb77e1d8e2a3 100644 --- a/Compiler/test/effects.jl +++ b/Compiler/test/effects.jl @@ -1486,3 +1486,10 @@ let effects = Base.infer_effects((Core.SimpleVector,Int); optimize=false) do sve end @test Compiler.is_nothrow(Base.infer_effects(length, (Core.SimpleVector,))) + + +# https://github.com/JuliaLang/julia/issues/60009 +function null_offset(offset) + Ptr{UInt8}(C_NULL) + offset +end +@test null_offset(Int(100)) == Ptr{UInt8}(UInt(100))