Julia script segfault on errors

Hi, I have a strange behaviour with julia on NixOS

REPL:

versioninfo()
Julia Version 0.6.0
Commit 903644385b* (2017-06-19 13:05 UTC)
println(undef)
ERROR: UndefVarError: undef not defined

Script:
cat test.jl
println(undef)

julia test.jl

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
get at /nix/store/n88r1nlkykqq73z4gr50fk0cdc9mr7w7-gfortran-6.4.0/include/c++/6.4.0/bits/unique_ptr.h:308 [inlined]
getBinary at /nix/store/hrnlixqvhzibzggrbp6qpcwfalsh14zp-llvm-3.9.1/include/llvm/Object/Binary.h:181 [inlined]
jl_dylib_DI_for_fptr at /build/source/src/debuginfo.cpp:1242
jl_getDylibFunctionInfo at /build/source/src/debuginfo.cpp:1397 [inlined]
jl_getFunctionInfo at /build/source/src/debuginfo.cpp:1633
jl_lookup_code_address at /build/source/src/stackwalk.c:348
lookup at ./stacktraces.jl:125
collect_to! at ./array.jl:474
_collect at ./array.jl:455
stacktrace at ./stacktraces.jl:151
display_error at ./client.jl:126
unknown function (ip: 0x7fe142ebb6dd)
jl_call_fptr_internal at /build/source/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /build/source/src/julia_internal.h:358 [inlined]
jl_apply_generic at /build/source/src/gf.c:1933
display_error at ./client.jl:140
unknown function (ip: 0x7fe142ebb146)
jl_call_fptr_internal at /build/source/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /build/source/src/julia_internal.h:358 [inlined]
jl_apply_generic at /build/source/src/gf.c:1933
do_call at /build/source/src/interpreter.c:75
eval at /build/source/src/interpreter.c:242
eval_body at /build/source/src/interpreter.c:539
jl_toplevel_eval_body at /build/source/src/interpreter.c:511
jl_toplevel_eval_flex at /build/source/src/toplevel.c:571
jl_toplevel_eval_in at /build/source/src/builtins.c:496
eval at ./boot.jl:235
unknown function (ip: 0x7fe158504d2f)
jl_call_fptr_internal at /build/source/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /build/source/src/julia_internal.h:358 [inlined]
jl_apply_generic at /build/source/src/gf.c:1933
_start at ./client.jl:417
unknown function (ip: 0x7fe158546fd8)
jl_call_fptr_internal at /build/source/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /build/source/src/julia_internal.h:358 [inlined]
jl_apply_generic at /build/source/src/gf.c:1933
[1] 2618 julia --color=yes test.jl

Should I report this on github? any cues on why is this happening?

Thanks, Nicolò

Is there perhaps a compiler mismatch between the gcc ABI version used to compile LLVM and to compile Julia? The path there looks a bit odd:
...gfortran-6.4.0/include/c++/...
I also wouldn’t be too surprised if this is simply a gcc bug :cry: and you might just have to compile with a different version of gcc.

Thanks, I opened an issue on the nixpkgs repository, I’ll keep this open until it gets fixed there. I don’t think it’s a gcc bug, the compiler version mismatch is more probable IMHO

Interestingly, this bug seems to only show up when invoking a Julia script. So I can do

julia> error("this is an error")

at the REPL and it works fine. But if I put error("this is an error") in a file test.jl and run julia test.jl, it’s a segfault.

Is there an obvious thing that would cause this (like a particular dependency mismatch or something)?