Skip to content

Pointer Integer addition ignored when in a function. #60009

@nhz2

Description

@nhz2

Starting in Julia 1.12, when adding a pointer to an integer in a function, the addition is ignored. When I do the addition outside the function, it works as expected.

function null_offset(offset)
    Ptr{UInt8}(C_NULL) + offset
end

@show Ptr{UInt8}(C_NULL) + Int(100)
@show null_offset(Int(100))
Ptr{UInt8}(C_NULL) + Int(100) = Ptr{UInt8}(0x0000000000000064)
null_offset(Int(100)) = Ptr{UInt8}(0x0000000000000000)
julia> versioninfo()
Julia Version 1.14.0-DEV.16
Commit ad6e4bbd68b (2025-10-31 17:42 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 9800X3D 8-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-20.1.8 (ORCJIT, znver5)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcorrectness bug ⚠Bugs that are likely to lead to incorrect results in user code without throwingregression 1.12Regression in the 1.12 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions