Skip to content

Commit

Permalink
Hack: work around a GC marking bug
Browse files Browse the repository at this point in the history
This test fails on this branch because pop! gets inlined, and a "ghost" `item` variable is created that, while never initialized, nevertheless holds a GC reference to the deleted object.
  • Loading branch information
timholy committed Jun 9, 2017
1 parent a144d45 commit c981dd1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,10 @@ mutable struct Obj; x; end
push!(r, x)
push!(wr, WeakRef(x))
end
@noinline function wr_pop!(a)
pop!(a)
nothing
end
test_wr(r,wr) = @test r[1] == wr[1].value
function test_wr()
ref = []
Expand All @@ -2223,7 +2227,7 @@ mutable struct Obj; x; end
test_wr(ref, wref)
gc()
test_wr(ref, wref)
pop!(ref)
wr_pop!(ref)
gc()
@test wref[1].value === nothing
end
Expand Down

0 comments on commit c981dd1

Please sign in to comment.