Julia: Unreachable reached in DataFrames.jl

Created on 21 Feb 2019  路  7Comments  路  Source: JuliaLang/julia

The source of the problem is https://github.com/JuliaData/DataFrames.jl/issues/1730.

Here is a MWE:

julia>     using Statistics

julia>     function get_stats(col::AbstractVector, stats::AbstractVector{Symbol})
               if :q25 in stats || :median in stats || :q75 in stats
                   try quantile(col, [.25, .5, .75]) catch end
               end

               if :min in stats || :max in stats
                   try extrema(col) catch end
               end

               if :mean in stats || :std in stats
                   m = try mean(col) catch end
               end

               if :std in stats
                   try std(col, mean=m) catch end
               end
           end
get_stats (generic function with 1 method)

julia>     get_stats(Int[], [:min])

Unreachable reached at 000000001F2D2ED9

The problem seems with the use of m in std. If we write try std(col) catch end not to use m the problem stops to be present.

Strangely removing other ifs also kills the problem. Note that the part of the code that causes the problem is not even executed as we pass [:min] as the second kewyord argument.

@JeffBezanson I know that there are many "Unreachable reached" issues, but I could not find one that is exactly the same (but maybe it is a duplicate).

bug

Most helpful comment

Reduced to:

function a()
  try catch end
  if try b catch end
    c = try 0 catch end
  end
  c
end
a()

Any chance this happened to be fixed by #31129 today?

Still crashes on freshly-built master, so no.

All 7 comments

If m is defined before the first if or we move if :std in stats inside the earlier if the problem is fixed so it seems that the compiler has some problem with deciding what m actually is.

Crashes in julia 0.7. Works in julia 0.6.

Any chance this happened to be fixed by https://github.com/JuliaLang/julia/pull/31129 today?

Reduced to:

function a()
  try catch end
  if try b catch end
    c = try 0 catch end
  end
  c
end
a()

Any chance this happened to be fixed by #31129 today?

Still crashes on freshly-built master, so no.

duplicate of https://github.com/JuliaLang/julia/issues/29152. We encounter %14 = 蠏 (%12::Union{Nothing, Int64}), and see that this must be dead-code (since %12 was assigned from #undef), so we skip generating the code for %14

image

I can't reproduce on the latest master, should this be closed?

On 1.4.0 (2020-03-21) this seems to be fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ararslan picture ararslan  路  3Comments

StefanKarpinski picture StefanKarpinski  路  3Comments

iamed2 picture iamed2  路  3Comments

sbromberger picture sbromberger  路  3Comments

omus picture omus  路  3Comments