False-positive with code using `@ccallable`
sjkelly opened this issue · 0 comments
sjkelly commented
Consider the following, using PackageCompiler's MyLib example:
module MyLib
export increment32, increment64
function increment(count)
count += 1
return count
end
Base.@ccallable function increment32(count::Cint)::Cint
count = increment(count)
println("Incremented count: $count (Cint)")
return count
end
Base.@ccallable function increment64(count::Clong)::Clong
count = increment(count)
println("Incremented count: $count (Clong)")
return count
end
end
and the following JET report:
sjkelly@deepsea4:~/.julia/dev/PackageCompiler/examples/MyLib (sjk/flag_api1=)$ julia --project
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.0 (2023-12-25)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using JET
julia> using MyLib
Precompiling MyLib
1 dependency successfully precompiled in 1 seconds
julia> JET.report_package(MyLib)
[toplevel-info] virtualized the context of Main (took 0.011 sec)
[toplevel-info] entered into /home/sjkelly/.julia/dev/PackageCompiler/examples/MyLib/src/MyLib.jl
[toplevel-info] exited from /home/sjkelly/.julia/dev/PackageCompiler/examples/MyLib/src/MyLib.jl (took 1.007 sec)
═════ 2 toplevel errors found ═════
┌ @ /home/sjkelly/.julia/dev/PackageCompiler/examples/MyLib/src/MyLib.jl:10
│ @ccallable was already defined for this method name
│ Stacktrace:
│ [1] _ccallable(rt::Type, sigt::Type)
│ @ Base ./c.jl:513
└──────────────────────
┌ @ /home/sjkelly/.julia/dev/PackageCompiler/examples/MyLib/src/MyLib.jl:16
│ @ccallable was already defined for this method name
│ Stacktrace:
│ [1] _ccallable(rt::Type, sigt::Type)
│ @ Base ./c.jl:513
└──────────────────────
This appears to be a false positive, and at least have an unclear fix considering this is standard code to interface with C. Is @ccallable
doing something strange to the method tables?