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) 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))