From: "k0kubun (Takashi Kokubun) via ruby-core" <ruby-core@...>
Date: 2023-07-22T03:44:08+00:00
Subject: [ruby-core:114258] [Ruby master Bug#19781] Stack consistency error with tailcall and YJIT enabled

Issue #19781 has been reported by k0kubun (Takashi Kokubun).



----------------------------------------

Bug #19781: Stack consistency error with tailcall and YJIT enabled

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



* Author: k0kubun (Takashi Kokubun)

* Status: Open

* Priority: Normal

* Assignee: yjit

* Backport: 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED

----------------------------------------

```rb

src = <<-EOS

  def apply_one_and_two(&block)

    [1, p(1)]

  end

���

  def add_one_and_two

    apply_one_and_two(&:+)

  end

EOS

���

RubyVM::InstructionSequence.new(

  "proc {|_|_.class_eval {#{src}}}",

  __FILE__, __FILE__, 1,

  tailcall_optimization: true,

  trace_instruction: false,

).eval[self.singleton_class]

���

def entry

  add_one_and_two

end

���

entry

```



This script causes "Stack consistency error" with `ruby --yjit-call-threshold=1` on any YJIT-enabled build (3.1, 3.2, and master).







-- 

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

 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/