Skip to content

if @generated functions missing source file and line number information #57572

@nsajko

Description

@nsajko

The file and line of source code are recorded as none:0:

julia> methods(Base.Math.var"#s706#1")
# 1 method for generic function "#s706#1" from Base.Math:
 [1] var"#s706#1"(::Any, x, p)
     @ none:0

julia> methods(Base.Math.var"#s706#2")
# 1 method for generic function "#s706#2" from Base.Math:
 [1] var"#s706#2"(::Any, z, p)
     @ none:0

julia> versioninfo()
Julia Version 1.13.0-DEV.139
Commit f5ce2497208 (2025-02-28 07:25 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-19.1.7 (ORCJIT, znver2)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 4
  JULIA_PKG_PRECOMPILE_AUTO = 0

The functions seem to be originate here:

julia/base/math.jl

Lines 95 to 101 in b0323ab

if @generated
N = length(p.parameters::Core.SimpleVector)
ex = :(p[end])
for i in N-1:-1:1
ex = :(muladd(x, $ex, p[$i]))
end
ex

julia/base/math.jl

Lines 120 to 139 in b0323ab

if @generated
N = length(p.parameters)
a = :(p[end])
b = :(p[end-1])
as = []
for i in N-2:-1:1
ai = Symbol("a", i)
push!(as, :($ai = $a))
a = :(muladd(r, $ai, $b))
b = :(muladd(-s, $ai, p[$i]))
end
ai = :a0
push!(as, :($ai = $a))
C = Expr(:block,
:(x = real(z)),
:(y = imag(z)),
:(r = x + x),
:(s = muladd(x, x, y*y)),
as...,
:(muladd($ai, z, $b)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorobservabilitymetrics, timing, understandability, reflection, logging, ...

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions