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 #34207

Closed
jagot opened this issue Dec 28, 2019 · 5 comments · Fixed by #34243
Closed

Unreachable reached #34207

jagot opened this issue Dec 28, 2019 · 5 comments · Fixed by #34243
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior

Comments

@jagot
Copy link
Contributor

jagot commented Dec 28, 2019

TOMLs attached. This occurs on nightly, but not on 1.0–1.3. On Linux "Unreachable reached" is printed, on macOS, it simply segfaults:

/Applications/Julia-1.4.app/Contents/Resources/julia/bin/julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0-DEV.667 (2019-12-27)
 _/ |\__'_|_|_|\__'_|  |  Commit acb7bd93fb (0 days old master)
|__/                   |

(@v1.4) pkg> activate .
Activating environment at `/private/tmp/crash/Project.toml`
julia> using AtomicLevels, HalfIntegers

julia> function crash(a, b)
           ao,bo = Orbital(:k, a.orb.ℓ),Orbital(:k, b.orb.ℓ)
           i,j = ao  bo ? (1,2) : (2,1)
           uv = (ao,bo)[[i,j]]
           m′m = (abs(a.m[1]), abs(b.m[1]))
           # Intermittent segfault on next line
           m′,m = uv[1] < uv[2] ? m′m[[i,j]] : reverse(minmax(m′m...))
       end
crash (generic function with 1 method)

julia> o = SpinOrbital(o"ks", 0, half(1))
ks₀α

julia> crash(o, o)

signal (11): Segmentation fault: 11
in expression starting at REPL[5]:1
_platform_strcmp at /usr/lib/system/libsystem_platform.dylib (unknown line)
Allocations: 30720411 (Pool: 30719296; Big: 1115); GC: 6
zsh: segmentation fault  /Applications/Julia-1.4.app/Contents/Resources/julia/bin/julia

TOMLs.zip

@Keno
Copy link
Member

Keno commented Dec 28, 2019

Slight reduction:

julia> function crash()
           ao,bo = Orbital(:k, 1),Orbital(:k, 2)
           i,j = ao ≤ bo ? (1,2) : (2,1)
           uv = (ao,bo)[[i,j]]
           # Intermittent segfault on next line
           uv[1] < uv[2]
       end

What's happening is that the runtime is producing a 2-tuple as a pair of pointers, but codegen is expecting the allocation to be inline.

@JeffBezanson
Copy link
Sponsor Member

Ah, then perhaps related to #34206?

Keno added a commit that referenced this issue Dec 28, 2019
This fastpath wasn't checking whether or not the element type
was inline allocated or not.

Fixes #34206
Fixes #34207
Keno added a commit that referenced this issue Dec 28, 2019
This fastpath wasn't checking whether or not the element type
was inline allocated or not.

Fixes #34206
Fixes #34207
@Keno Keno added kind:bug Indicates an unexpected problem or unintended behavior compiler:codegen Generation of LLVM IR and native code labels Dec 28, 2019
@jagot
Copy link
Contributor Author

jagot commented Dec 28, 2019

I really appreciate you for fixing these weird edge cases I always seem to come up with :)

@Keno
Copy link
Member

Keno commented Dec 28, 2019

This wasn't really that weird an edge case, just a fairly recent regression you happened to stumble upon.

@jagot
Copy link
Contributor Author

jagot commented Dec 28, 2019

I'm happy anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
3 participants