Issue #12018 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED

----------------------------------------
Bug #12018: Tail call optimization is incorrectly applied in Ruby 2.3.0
https://bugs.ruby-lang.org/issues/12018#change-56702

* Author: Kazuki Yamaguchi
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.4.0dev (2016-01-25 trunk 53652) [x86_64-linux]
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED
----------------------------------------
r51903 changed the operand order of send/invokesuper instructions, but the code applying tail call optimization still looks at the second operand, which is now CALL_CACHE.
The following code causes a segmentation fault:

~~~ruby
RubyVM::InstructionSequence.compile_option = { tailcall_optimization: true }

def just_yield
  yield
end

eval "just_yield { }"
~~~

I attached a patch to fix it.

---Files--------------------------------
0001-compile.c-fix-tailcall-optimization.patch (1.12 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>