Skip to content

crash with isdefined inside try block inside loop #32820

Closed
@JeffBezanson

Description

@JeffBezanson
function f(refs)
    local x
    for r in refs
        try
            error()
        catch e
            if !@isdefined(x)
                x = []
            end
            push!(x, 1)
        end
    end
end

f(Any[1])

gives

signal (11): Segmentation fault
in expression starting at REPL[2]:1
jl_array_grow_end at /home/jeff/src/julia/src/array.c:916
_growend! at ./array.jl:825 [inlined]
push! at ./array.jl:873 [inlined]
f at /home/jeff/src/julia/crash.jl:10

in all julia versions since 1.0.

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