Skip to content

maximum of a vector #104

@Thomas008

Description

@Thomas008

Compiling maximum() seems to result in error messages. Probalby it is due to the fact that maximum() is not type-stable, so it is no issue of juliac actually?

function (@main)(args::Vector{String})::Cint
  m = maximum([1,2,3])
  return 0
end
Verifier error #1: unresolved call from statement Base.reduce_empty(op::Function, T::Type)::Any
Stacktrace:
  [1] mapreduce_empty(::typeof(identity), op::Function, T::Type)
    @ Base reduce.jl:369
  [2] reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, ::Type{Int64})
    @ Base reduce.jl:358
  [3] reduce_empty_iter(op::Base.MappingRF{typeof(identity), typeof(max)}, itr::Vector{Int64}, ::Base.HasEltype)
    @ Base reduce.jl:381 [inlined]
  [4] mapreduce_empty_iter(f::typeof(identity), op::typeof(max), itr::Vector{Int64}, ItrEltype::Base.HasEltype)
    @ Base reduce.jl:377
  [5] _mapreduce(f::typeof(identity), op::typeof(max), ::IndexLinear, A::Vector{Int64})
    @ Base reduce.jl:431 [inlined]
  [6] _mapreduce_dim(f::typeof(identity), op::typeof(max), ::Base._InitialValue, A::Vector{Int64}, ::Colon)
    @ Base reducedim.jl:338 [inlined]
  [7] mapreduce(f::typeof(identity), op::typeof(max), A::Vector{Int64}; dims::Colon, init::Base._InitialValue)
    @ Base reducedim.jl:330 [inlined]
  [8] _maximum(f::typeof(identity), a::Vector{Int64}, ::Colon; kw::@Kwargs{})
    @ Base reducedim.jl:988 [inlined]
  [9] _maximum(a::Vector{Int64}, ::Colon; kw::@Kwargs{})
    @ Base reducedim.jl:987 [inlined]
 [10] maximum(a::Vector{Int64}; dims::Colon, kw::@Kwargs{})
    @ Base reducedim.jl:983 [inlined]
 [11] main(args::Vector{String})
    @ Main C:\jul\JulWork\parajul\jc\test_jl3.jl:2
 [12] _main(argc::Int32, argv::Ptr{Ptr{Int8}})
    @ Main C:\Users\PCUser\.julia\juliaup\julia-1.13.0-alpha2+0.x64.w64.mingw32\share\julia\juliac\juliac-buildscript.jl:35

Verifier error #2: unresolved call from statement Base.reduce_empty(op::Function, T::Type)::Any
Stacktrace:
  [1] mapreduce_empty(::typeof(identity), op::Function, T::Type)
    @ Base reduce.jl:369
  [2] reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, ::Type{Int64})
    @ Base reduce.jl:358
  [3] reduce_empty_iter(op::Base.MappingRF{typeof(identity), typeof(max)}, itr::Vector{Int64}, ::Base.HasEltype)
    @ Base reduce.jl:381 [inlined]
  [4] mapreduce_empty_iter(f::typeof(identity), op::typeof(max), itr::Vector{Int64}, ItrEltype::Base.HasEltype)
    @ Base reduce.jl:377
  [5] _mapreduce(f::typeof(identity), op::typeof(max), ::IndexLinear, A::Vector{Int64})
    @ Base reduce.jl:431 [inlined]
  [6] _mapreduce_dim(f::typeof(identity), op::typeof(max), ::Base._InitialValue, A::Vector{Int64}, ::Colon)
    @ Base reducedim.jl:338 [inlined]
  [7] mapreduce(f::typeof(identity), op::typeof(max), A::Vector{Int64}; dims::Colon, init::Base._InitialValue)
    @ Base reducedim.jl:330 [inlined]
  [8] _maximum(f::typeof(identity), a::Vector{Int64}, ::Colon; kw::@Kwargs{})
    @ Base reducedim.jl:988 [inlined]
  [9] _maximum(a::Vector{Int64}, ::Colon; kw::@Kwargs{})
    @ Base reducedim.jl:987 [inlined]
 [10] maximum(a::Vector{Int64}; dims::Colon, kw::@Kwargs{})
    @ Base reducedim.jl:983 [inlined]
 [11] main(args::Vector{String})
    @ Main C:\jul\JulWork\parajul\jc\test_jl3.jl:2
 [12] _main(argc::Int32, argv::Ptr{Ptr{Int8}})
    @ Main C:\Users\PCUser\.julia\juliaup\julia-1.13.0-alpha2+0.x64.w64.mingw32\share\julia\juliac\juliac-buildscript.jl:35

Trim verify finished with 2 errors, 0 warnings.
fatal: error thrown and no exception handler available.
UndefVarError(var=:exit, world=0x0000000000002c46, scope=Base.Compiler)
ijl_undefined_var_error at C:/workdir/src\rtutils.c:167
compile_and_emit_native at .\../usr/share/julia/Compiler/src\precompile.jl:421
jfptr_compile_and_emit_native_89025 at C:\Users\PCUser\.julia\juliaup\julia-1.13.0-alpha2+0.x64.w64.mingw32\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:2275 [inlined]
jl_create_native_impl at C:/workdir/src\aotcompile.cpp:723
ijl_create_system_image at C:/workdir/src\staticdata.c:3372
ijl_write_compiler_output at C:/workdir/src\precompile.c:140
ijl_atexit_hook at C:/workdir/src\init.c:279
jl_repl_entrypoint at C:/workdir/src\jlapi.c:1139
mainCRTStartup at C:/workdir/cli\loader_exe.c:58
BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions