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

MWE of char crash #28

Closed
GunnarFarneback opened this issue Feb 14, 2019 · 8 comments · Fixed by #67
Closed

MWE of char crash #28

GunnarFarneback opened this issue Feb 14, 2019 · 8 comments · Fixed by #67

Comments

@GunnarFarneback
Copy link

This reproduces the crash in the char tests.

using JuliaInterpreter
ex = quote
    a = ['0']
    b = ['a']
    c = [a; b]
end
frame = JuliaInterpreter.prepare_toplevel(Main, ex)
JuliaInterpreter.finish_and_return!(JuliaStackFrame[], frame, true)

with the result

Unreachable reached at 0x7f9c2cce8ab4

signal (4): Illegal instruction
[...]
@KristofferC
Copy link
Member

KristofferC commented Feb 14, 2019

Seems to work locally on Windows on both 1.1 and master.

julia> JuliaInterpreter.finish_and_return!(JuliaStackFrame[], frame, true)
 2-element Array{Char,1}:
 '0'
 'a'

> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

@GunnarFarneback
Copy link
Author

julia> versioninfo()
Julia Version 1.2.0-DEV.320
Commit 38d6247 (2019-02-13 21:23 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  IPYTHON_JL_SETUP_PYJULIA = no

@timholy
Copy link
Member

timholy commented Feb 14, 2019

I can replicate with both 1.1 and master.

julia> versioninfo()
Julia Version 1.1.1-pre.0
Commit a84cf6f56c* (2019-01-22 04:33 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIAFUNCDIR = /home/tim/juliafunc
  JULIA_CPU_THREADS = 2

(My master is one commit later than @GunnarFarneback)

@pfitzseb
Copy link
Member

This is the line that fails, I think. Maybe something going wrong with the @_gc_preserve_begin?

@timholy
Copy link
Member

timholy commented Feb 14, 2019

Here's a repro that doesn't even use JuliaInterpreter:

julia> a, b = ['0'], ['a'];

julia> eltype(a)
Char

julia> arr = Vector{Char}(undef, 2)
2-element Array{Char,1}:
 '\0'              
 '\x00\x00\x7f\x89'

julia> ptr = pointer(arr)
Ptr{Char} @0x00007f893d190cb0

julia> elsz = sizeof(Char)
4

julia> na = length(a)
1

julia> nba = na * elsz
4

julia> ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt), ptr, a, nba)
Unreachable reached at 0x7f893412a95e

I'll file this as a Julia issue.

@timholy
Copy link
Member

timholy commented Feb 14, 2019

JuliaLang/julia#31073

@GunnarFarneback
Copy link
Author

The arrayops crash looks very similar to this one. They may well have the same cause.

@timholy
Copy link
Member

timholy commented Feb 20, 2019

If we do #13 (comment), it might fix this issue too. If not, we need to develop a workaround for this. Even if the bug is fixed in Julia itself, I doubt we want to force people to run a 3-day old master in order to use JuliaInterpreter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants