From 9168cad4d63a5d281d443bde4edea6be213b0b25 Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Thu, 11 Dec 2025 15:56:16 -0700 Subject: YJIT: Bail out if proc would be stored above stack top Fixes [Bug #21266]. --- test/ruby/test_yjit.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index ce9dfca390..2096585451 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -1772,6 +1772,18 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_proc_block_with_kwrest + # When the bug was present this required --yjit-stats to trigger. + assert_compiles(<<~RUBY, result: {extra: 5}) + def foo = bar(w: 1, x: 2, y: 3, z: 4, extra: 5, &proc { _1 }) + def bar(w:, x:, y:, z:, **kwrest) = yield kwrest + + GC.stress = true + foo + foo + RUBY + end + private def code_gc_helpers -- cgit v1.2.3