Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreachable reached in DataFrames.jl #31133

Closed
bkamins opened this issue Feb 21, 2019 · 7 comments
Closed

Unreachable reached in DataFrames.jl #31133

bkamins opened this issue Feb 21, 2019 · 7 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@bkamins
Copy link
Member

bkamins commented Feb 21, 2019

The source of the problem is JuliaData/DataFrames.jl#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).

@bkamins
Copy link
Member Author

bkamins commented Feb 21, 2019

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.

@KristofferC KristofferC added the bug Indicates an unexpected problem or unintended behavior label Feb 21, 2019
@KristofferC
Copy link
Member

Crashes in julia 0.7. Works in julia 0.6.

@vtjnash
Copy link
Member

vtjnash commented Feb 21, 2019

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

@maleadt
Copy link
Member

maleadt commented Feb 21, 2019

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.

@vtjnash
Copy link
Member

vtjnash commented Feb 21, 2019

duplicate of #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

@Liozou
Copy link
Member

Liozou commented Apr 1, 2020

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

@bkamins
Copy link
Member Author

bkamins commented Apr 1, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

6 participants