Skip to content

Segfault in Julia 1.2.0-rc2.0 on assigning to a static parameter in a while loop #32620

@coroa

Description

@coroa

The following MWE leads to a segmentation fault in 1.2-rc2

abstract type A end

abstract type B{F} <: A end

function deunion(::Type{T}) where T <: A
    while T isa UnionAll
        T = T.body
    end
    T
end

deunion(B)

with the stack trace:

~ julia mwe.jl    

signal (11): Segmentation fault
in expression starting at /home/coroa/mwe.jl:12
_ZL19emit_array_nd_indexR12jl_codectx_tRK10jl_cgval_tP11_jl_value_tlPS2_mS5_.isra.1424 at /home/coroa/.julia/julia-1.2/bin/../lib/libjulia.so.1 (unknown line)
emit_ssaval_assign at /home/coroa/src/juliav1.2/src/codegen.cpp:3737
emit_function at /home/coroa/src/juliav1.2/src/codegen.cpp:3929
jl_compile_linfo at /home/coroa/src/juliav1.2/src/codegen.cpp:1199
jl_compile_method_internal at /home/coroa/src/juliav1.2/src/gf.c:1775
jl_apply_generic at /home/coroa/src/juliav1.2/src/gf.c:2196
do_call at /home/coroa/src/juliav1.2/src/interpreter.c:323
eval_value at /home/coroa/src/juliav1.2/src/interpreter.c:411
eval_stmt_value at /home/coroa/src/juliav1.2/src/interpreter.c:362 [inlined]
eval_body at /home/coroa/src/juliav1.2/src/interpreter.c:758
jl_interpret_toplevel_thunk_callback at /home/coroa/src/juliav1.2/src/interpreter.c:884
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f9f8b862d8f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /home/coroa/src/juliav1.2/src/interpreter.c:893
jl_toplevel_eval_flex at /home/coroa/src/juliav1.2/src/toplevel.c:815
jl_parse_eval_all at /home/coroa/src/juliav1.2/src/ast.c:873
jl_load at /home/coroa/src/juliav1.2/src/toplevel.c:879
include at ./boot.jl:328 [inlined]
include_relative at ./loading.jl:1094
include at ./Base.jl:31
jl_apply_generic at /home/coroa/src/juliav1.2/src/gf.c:2191
exec_options at ./client.jl:295
_start at ./client.jl:464
jl_apply_generic at /home/coroa/src/juliav1.2/src/gf.c:2191
unknown function (ip: 0x5565d46cb6fd)
unknown function (ip: 0x5565d46cb323)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x5565d46cb3c9)
Allocations: 199949 (Pool: 199760; Big: 189); GC: 0
[1]    20039 segmentation fault  julia mwe.jl 

Version

julia> versioninfo()
Julia Version 1.2.0-rc2.0
Commit 9248bf7687 (2019-07-08 19:42 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, haswell)

Behaviour on 1.1

Julia 1.1 throws a TypeError instead:

➜  ~ julia-1.1
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.1 (2019-05-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> include("mwe.jl")
ERROR: LoadError: UndefVarError: T not defined
Stacktrace:
 [1] deunion(::Type{B}) at /home/coroa/mwe.jl:6
 [2] top-level scope at none:0
 [3] include at ./boot.jl:326 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] include(::String) at ./client.jl:403
 [7] top-level scope at none:0
in expression starting at /home/coroa/mwe.jl:12

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions