From: ts Date: 2001-10-09T00:21:58+09:00 Subject: [ruby-talk:22243] Re: Segmentation fault with callcc >>>>> "K" == Klaus Spreckelsen writes: K> class Array K> def elt(g) K> g[0].call if g[0] K> each do |i| K> callcc do |g[0]| K> return i K> end K> end K> end K> end K> a = [1] K> g1 = [] K> g2 = [] K> x = [a.elt(g1), a.elt(g2)] K> #y = a.elt(g1) K> z = [a.elt(g1), a.elt(g1)] Write it like this : a = [1] g1 = [] a.elt(g1) puts "First return or callcc" a.elt(g1) The second call to #elt make ruby resume to the line #puts (where the continuation was captured) when it leave #elt, this is why you have an infinite loop. K> a:6: [BUG] Segmentation fault K> ruby 1.7.1 (2001-09-08) [i686-linux] K> Abort A patch was sent for this problem, it make normally an infinite loop with pigeon% ruby -v ruby 1.7.1 (2001-10-05) [i686-linux] pigeon% Guy Decoux