#977193 julia REPL crashes on simple function

Package:
julia
Source:
julia
Description:
high-performance programming language for technical computing
Submitter:
Zoltan Barta
Date:
2022-06-25 09:39:26 UTC
Severity:
important
#977193#5
Date:
2020-12-12 10:44:48 UTC
From:
To:
Dear Maintainer,

   * What led up to the situation?

When I am running these in the REPL there is no problem.

julia> include("good.jl")
probak (generic function with 2 methods)

julia> c,f = probak()
([[1, 2, 3]], [1.0954451150103321])

On the other hand, running these crashes julia:

julia> include("bad.jl")
probak (generic function with 2 methods)

julia> c,f = probak()

The only difference between good.jl and bad.jl is this line (both attached):
randn() < 0.0 && return [4,5,6], 1.233
vs
randn() < 0.0 && return [4,5,6]

Runing at the command line, (e.g. julia bad.jl) runs without problems.

Many thanks for your effort,
Zoltan

function proba(;α = 0.1)
	randn() < 0.0 && return [4,5,6]
	return [1,2,3], 1.2^α
end

function probak(α = 0.5)
	kont1 = Array{Array{Int,1},1}()
	kont2 = Array{Float64, 1}()
	k1, k2 = proba(α = α)
	push!(kont1, k1)
	push!(kont2, k2)
	return kont1, kont2
end

<<<
	randn() < 0.0 && return [4,5,6], 1.233
	return [1,2,3], 1.2^α
end

function probak(α = 0.5)
	kont1 = Array{Array{Int,1},1}()
	kont2 = Array{Float64, 1}()
	k1, k2 = proba(α = α)
	push!(kont1, k1)
	push!(kont2, k2)
	return kont1, kont2
end

<<<

   * What exactly did you do (or not do) that was effective (or ineffective)?

julia> include("bad.jl")
probak (generic function with 2 methods)

julia> c,f = probak()

   * What was the outcome of this action?

Illegal inttoptr
          %23 = ptrtoint %jl_value_t addrspace(10)* %20 to i64, !dbg !19
Illegal inttoptr
          %24 = inttoptr i64 %23 to i64 addrspace(13)*, !dbg !19

signal (6): Aborted
in expression starting at REPL[2]:1
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x7f315d7872f0)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /usr/bin/../lib/x86_64-linux-gnu/libLLVM-10.so.1 (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /usr/bin/../lib/x86_64-linux-gnu/libLLVM-10.so.1 (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /usr/bin/../lib/x86_64-linux-gnu/libLLVM-10.so.1 (unknown line)
unknown function (ip: 0x7f315d87a537)
unknown function (ip: 0x7f315d87d004)
unknown function (ip: 0x7f315d87dcce)
unknown function (ip: 0x7f315d87f12a)
unknown function (ip: 0x7f315d87fefd)
unknown function (ip: 0x7f315d880ec8)
unknown function (ip: 0x7f315d8100cb)
jl_apply_generic at /usr/bin/../lib/x86_64-linux-gnu/libjulia.so.1 (unknown line)
unknown function (ip: 0x7f315d824854)
unknown function (ip: 0x7f315d8244f5)
unknown function (ip: 0x7f315d825087)
unknown function (ip: 0x7f315d825b1e)
unknown function (ip: 0x7f315d83e028)
unknown function (ip: 0x7f315d83e5e8)
jl_toplevel_eval_in at /usr/bin/../lib/x86_64-linux-gnu/libjulia.so.1 (unknown line)
eval at ./boot.jl:331
eval_user_input at /build/julia-pTK15f/julia-1.5.3+dfsg/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:134
repl_backend_loop at /build/julia-pTK15f/julia-1.5.3+dfsg/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:195
start_repl_backend at /build/julia-pTK15f/julia-1.5.3+dfsg/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:180
#run_repl#37 at /build/julia-pTK15f/julia-1.5.3+dfsg/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:292
run_repl at /build/julia-pTK15f/julia-1.5.3+dfsg/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
#807 at ./client.jl:399
jfptr_YY.807_56835.clone_1 at /usr/lib/x86_64-linux-gnu/julia/sys.so (unknown line)
unknown function (ip: 0x7f315d81ba8f)
jl_f__apply_latest at /usr/bin/../lib/x86_64-linux-gnu/libjulia.so.1 (unknown line)
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
run_main_repl at ./client.jl:383
exec_options at ./client.jl:313
_start at ./client.jl:506
jfptr__start_42866.clone_1 at /usr/lib/x86_64-linux-gnu/julia/sys.so (unknown line)
unknown function (ip: 0x5592d19e1755)
unknown function (ip: 0x5592d19e1332)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x5592d19e13d9)
Allocations: 771272 (Pool: 771185; Big: 87); GC: 1
Aborted

   * What outcome did you expect instead?

julia> include("good.jl")
probak (generic function with 2 methods)

julia> c,f = probak()
([[1, 2, 3]], [1.0954451150103321])


Julia versioninfo() output:
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3
 _/ |\__'_|_|_|\__'_|  |  Debian ⛬  julia/1.5.3+dfsg-2+b2
|__/                   |

julia> using InteractiveUtils

julia> versioninfo()
Julia Version 1.5.3
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-10.0.1 (ORCJIT, skylake)

#977193#10
Date:
2020-12-12 12:36:10 UTC
From:
To:
Hi Zoltan,

thanks for your report. Interesting.

Then I tried:
- upstream original 1.5.2
	worked, got answer, no error
- upstream original 1.5.3
	got error
	julia> c,f = probak()
	ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Array{Int64,1}
	Closest candidates are:
	  convert(::Type{T}, ::AbstractArray) where T<:Array at array.jl:554
	  convert(::Type{T}, ::T) where T<:AbstractArray at abstractarray.jl:14
	  convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/factorization.jl:55
	  ...
	Stacktrace:
	 [1] push!(::Array{Array{Int64,1},1}, ::Int64) at ./array.jl:934
	 [2] probak at /home/norbert/Development/Julia/bugs/977193/bad.jl:10 [inlined]
	 [3] probak() at /home/norbert/Development/Julia/bugs/977193/bad.jl:7
	 [4] top-level scope at REPL[2]:1

Both official Julia packages are compiled with LLVM9, while the one in
Debian with LLVM10.

I will build Debian julia 1.5.3 packages and see how they fare!

Best

Norbert

#977193#15
Date:
2022-06-25 09:35:16 UTC
From:
To:
Dear submitter,

as the package julia has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1011382

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)