From: Paul Brannan Date: 2001-09-29T00:43:15+09:00 Subject: [ruby-talk:21806] Segfault with callcc PragDave suggested that I post this to the ML, since it's an interesting bug. Perhaps some clever person out there knows what's going on. It seems that when I try to use callcc, I keep segfaulting the Ruby interpreter (1.6.5). I have workarounds for my code (the one that's worked the best so far is putting set_trace_proc proc{} at the top of my script), but the bug keeps rearing its head unexpectedly. The following code repeatably segfaults the Ruby interpreter: class Foo def initialize(arr) cc1 = nil arr.each do |f| cc1 = callcc do |cc2| callcc do |cc1| cc2.call(cc1) end return end end # If I put a puts "foo" here, then this code doesn't crash. cc1.call(nil) unless not cc1 end end a = b = [ 1 ] Foo.new(a) Foo.new(b) There are some more examples in bug 185 at: http://www.ruby-lang.org/cgi-bin/ruby-bugs/incoming?id=185;expression=callcc;user=guest Any ideas what's going on? Thanks, Paul