ITADN

segfault when nesting expressions

#136OpenKrastanov 创建于 2025-09-07
K
Krastanovcommented
Below I show two different "resumable" functions that should do exactly the same operation. One has a few expressions that depend on each other, one after the other (and it works fine). The other one has all the expressions nested in a single expression and causes a segfault. ``` using ResumableFunctions LOG = [] @resumable function f() @yield 1 end @resumable function g1(LOG) rf = f() res = @yieldfrom rf push!(LOG, res) end collect(g1(LOG)) # returns [1] and LOG is updated to be [1] @resumable function g2(LOG) # same as g1 but all the expressions are nested together push!(LOG, @yieldfrom f()) end collect(g2(LOG)) # segfaults ``` Given that this is a segfault in what should be safe julia code, this is also reported upstream to julia https://github.com/JuliaLang/julia/issues/59502
0 条评论