JuliaLang / PackageCompiler.jl

Compile your Julia Package
https://julialang.github.io/PackageCompiler.jl/dev/
MIT License
1.4k stars 186 forks source link

Wrong return for supertype() in functions for compiled sysimage with option--strip-ir #895

Open kruxigt opened 8 months ago

kruxigt commented 8 months ago

I have previously posted this at https://github.com/JuliaLang/julia/issues/51751 but I'm guessing it belongs here as well?

Steps: 1, Generate new package "TestBuild"

2, Add the following functions

function test_supertype(t::Type) return supertype(t) end

function test_supertype_math(t::Type{T}) where T <: Number return supertype(t) end 3, Build systemimage with a = Cmd(["--strip-ir", "--compile=all", "--strip-metadata"]) create_sysimage(["TestBuild"]; sysimage_path="TestBuild.so", sysimage_build_args=a)

4 Start Julia with sysimage: Julia -JTestBuild.so --startup-file=no

5, Try the functions:

julia> using .TestBuild julia> TestBuild.test_supertype(Int64) Signed julia> TestBuild.test_supertype_math(Int64) Integer This seems like a fairly serious issue?

julia> versioninfo() Julia Version 1.10.0-rc1 Commit https://github.com/JuliaLang/julia/commit/5aaa94854367ca875375e38ae14f369f124e7315 (2023-11-03 07:44 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: macOS (x86_64-apple-darwin22.4.0) CPU: 8 × Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-15.0.7 (ORCJIT, icelake-client) Threads: 11 on 8 virtual cores

KristofferC commented 8 months ago

This is a Julia bug though so while it could potentially be useful to track it here, the fix has to be done in Julia.

kruxigt commented 8 months ago

This is a Julia bug though so while it could potentially be useful to track it here, the fix has to be done in Julia.

That makes sense! Is this a known bug?

KristofferC commented 8 months ago

It seems so since there is an issue open about it here https://github.com/JuliaLang/julia/issues/51751. ;)