From: Soutaro Matsumoto Date: 2009-01-29T16:33:44+09:00 Subject: [ruby-core:21657] [BUG:1.9] crash on variable reference in BEGIN inside class Hi, ruby 1.9 crashes on variable reference in BEGIN block inside class or block like the following. class C x = 10 BEGIN { puts x } end lambda { x = 10 BEGIN { puts x } } Prohibiting BEGIN in non-toplevel scope seems good for me. $ rubysvn --version ruby 1.9.1p5000 (2009-01-29 trunk 21874) [i386-darwin9.6.0] $ rubysvn class C x = 10 BEGIN { puts x } end rubysvn: [BUG] get_local_var_idx: -1 ruby 1.9.1p5000 (2009-01-29 trunk 21874) [i386-darwin9.6.0] -- control frame ---------- c:0002 p:-587732 s:0004 b:0004 l:000003 d:000003 TOP c:0001 p:0000 s:0002 b:0002 l:000004 d:000004 TOP
:54964 --------------------------- -- Ruby level backtrace information----------------------------------------- -- C level backtrace information ------------------------------------------- 0x119612 0 rubysvn 0x00119612 rb_vm_bugreport + 82 0x2cf6c 1 rubysvn 0x0002cf6c rb_warning + 444 0x2cfcb 2 rubysvn 0x0002cfcb rb_bug + 43 0xf3461 3 rubysvn 0x000f3461 rb_iseq_translate_threaded_code + 1345 0xf5a5c 4 rubysvn 0x000f5a5c rb_parse_in_main + 3692 0xfdcf9 5 rubysvn 0x000fdcf9 rb_iseq_compile_node + 3193 0xfde1a 6 rubysvn 0x000fde1a rb_iseq_compile_node + 3482 0xfee68 7 rubysvn 0x000fee68 rb_iseq_compile_node + 7656 0xf6b67 8 rubysvn 0x000f6b67 rb_parse_in_main + 8055 0xf84b3 9 rubysvn 0x000f84b3 rb_parse_in_main + 14531 0xfd4fc 10 rubysvn 0x000fd4fc rb_iseq_compile_node + 1148 0x100dbb 11 rubysvn 0x00100dbb ruby_debug_breakpoint + 3579 0x100e71 12 rubysvn 0x00100e71 rb_iseq_new_main + 97 0xbe7e6 13 rubysvn 0x000be7e6 ruby_set_argv + 2326 0x108dff 14 rubysvn 0x00108dff rb_vm_call_cfunc + 175 0xbea9d 15 rubysvn 0x000bea9d ruby_process_options + 157 0x3210b 16 rubysvn 0x0003210b ruby_options + 123 0x2147 17 rubysvn 0x00002147 main + 87 0x20b6 18 rubysvn 0x000020b6 start + 54 [NOTE] You may encounter a bug of Ruby interpreter. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html -- Soutaro Matsumoto