Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions base/compiler/ssair/slot2ssa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,10 @@ function construct_ssa!(ci::CodeInfo, code::Vector{Any}, ir::IRCode, domtree::Do
eidx = findfirst(x->x[1] == item, catch_entry_blocks)
if eidx !== nothing
for (slot, _, node) in phicnodes[catch_entry_blocks[eidx][2]]
ivalundef = incoming_vals[slot_id(slot)] === undef_token
unode = ivalundef ? UpsilonNode() : UpsilonNode(incoming_vals[slot_id(slot)])
typ = ivalundef ? MaybeUndef(Union{}) : slottypes[slot_id(slot)]
ival = incoming_vals[slot_id(slot)]
ivalundef = ival === undef_token
unode = ivalundef ? UpsilonNode() : UpsilonNode(ival)
typ = ivalundef ? MaybeUndef(Union{}) : typ_for_val(ival, ci, sptypes, -1, slottypes)
push!(node.values,
NewSSAValue(insert_node!(ir, first_insert_for_bb(code, cfg, item),
typ, unode, true).id - length(ir.stmts)))
Expand Down
17 changes: 17 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7024,3 +7024,20 @@ let code = code_lowered(FieldConvert)[1].code
@test code[10] == Expr(:new, Core.SSAValue(1), Core.SSAValue(3), Core.SSAValue(5), Core.SlotNumber(4), Core.SSAValue(7), Core.SSAValue(9))
@test code[11] == Expr(:return, Core.SSAValue(10))
end

# Issue #32820
function f32820(refs)
local x
for r in refs
try
error()
catch e
if !@isdefined(x)
x = []
end
push!(x, 1)
end
end
x
end
@test f32820(Any[1,2]) == Any[1, 1]