diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index c82018dc8e..e9bf1f16b6 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -176,6 +176,14 @@ class TestThread < Test::Unit::TestCase t2.kill if t2 end + def test_new_symbol_proc + bug = '[ruby-core:80147] [Bug #13313]' + assert_ruby_status([], "#{<<-"begin;"}\n#{<<-'end;'}", bug) + begin; + exit("1" == Thread.start(1, &:to_s).value) + end; + end + def test_join t = Thread.new { sleep } assert_nil(t.join(0.05)) diff --git a/thread.c b/thread.c index 9840880925..fffce53675 100644 --- a/thread.c +++ b/thread.c @@ -555,10 +555,11 @@ thread_do_start(rb_thread_t *th, VALUE args) { native_set_thread_name(th); if (!th->first_func) { + const VALUE *ep = vm_proc_ep(th->first_proc); rb_proc_t *proc; GetProcPtr(th->first_proc, proc); th->errinfo = Qnil; - th->root_lep = rb_vm_ep_local_ep(vm_proc_ep(th->first_proc)); + th->root_lep = ep ? rb_vm_ep_local_ep(ep) : NULL; th->root_svar = Qfalse; EXEC_EVENT_HOOK(th, RUBY_EVENT_THREAD_BEGIN, th->self, 0, 0, 0, Qundef); th->value = rb_vm_invoke_proc(th, proc,