Skip to content

Instantly share code, notes, and snippets.

@willb
Created October 20, 2009 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willb/214544 to your computer and use it in GitHub Desktop.
Save willb/214544 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Why does this crash ruby 1.8.6 in Fedora 11 and 12?
# It seems to work in 1.8.5 and 1.8.7.
module Frotz
DICT = {
'map' => 'MAP'
}
end
def do_crashy
result = Crashy.new
yield result.args if block_given?
result
end
class Crashy
attr_reader :args
def initialize
@args = arg_struct
end
private
def arg_struct
@@prototype_args ||= gen_proto_args
@@prototype_args.clone
end
def gen_proto_args
proto_args = []
def proto_args.declare(kind)
# Any reference to Frotz causes ruby 1.8.6 in Fedora 11 and 12 to segfault
# however, "d = ::Frotz::DICT" does not fail
d = Frotz::DICT
kind = d[kind] if d[kind]
self << [kind]
end
proto_args
end
end
cr = do_crashy do |args|
args.declare "blah"
end
p cr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment