using LinearAlgebra
function (@main)(args::Vector{String})::Cint
m = rand(Float64, 3, 3)
for i in 1:3
for j in 1:3
print(Core.stdout, m[i, j], " ")
end
println(Core.stdout)
end
result = -Inf
try
result = det(m)
catch e
println(Core.stdout, "Error occured")
println(Core.stdout, typeof(e))
end
println(Core.stdout, "Determinant of matrix m is: ", result)
return 0
end
# This file currently throws a TypeError
# due to possibly a type unstability in the LinearAlgebra.det()
Strange, I was under the impression that type instabilities would result in compile-time warnings/errors, but that looks very much like a runtime error. What happens when you don’t try-catch, could you let the stacktrace print out and see what calls threw it?
Might be worth making the matrix values constant while you work it out, but those printed values should work fine with det.
julia> using LinearAlgebra # 1.12.0-rc1
julia> [0.8743122811827831 0.6300620531943388 0.3450695610105955
0.7027868683889693 0.8758619592106516 0.2880180735794807
0.6450057839884562 0.3323840835725862 0.8649912996516349] |> det
0.19838562158551779
On my system, it does compile and provide a numerical result (and no error) using the 1.12 release candidate. I have experienced the same as you have on the nightly releases. I don’t know the difference between the two, but it seems the nightly version is still more unstable than the 1.12 rc.
@topolarity - Thank you for the response. Whenever I remove the --trim flag, it successfully compiles and runs as expected (but indeed it’s very big). I’m now leaving the Makefile as is with the nightly build and I will be watching the latest news on the juliac.
Thanks again for those who contribute to juliac again.