summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorRandy Stauner <randy@r4s6.net>2025-11-04 13:29:14 -0700
committerGitHub <noreply@github.com>2025-11-04 20:29:14 +0000
commit962aa14f240f43ca3bf3516432f7c3a6fbd1d3ff (patch)
treee1feeab25b19f15af4c5177c0f7f84f3057c9f3a /test/ruby
parentf1f2dfebe8a3ed770e3263fb9379d1fb51f85feb (diff)
ZJIT: Add test to reproduce binarytrees crash (#15054)
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_zjit.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index de2d1e6152..ae1af5c2c0 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -3164,6 +3164,37 @@ class TestZJIT < Test::Unit::TestCase
}, call_threshold: 2
end
+ def test_regression_cfp_sp_set_correctly_before_leaf_gc_call
+ omit 'reproduction for known, unresolved ZJIT bug'
+
+ assert_compiles ':ok', %q{
+ def check(l, r)
+ return 1 unless l
+ 1 + check(*l) + check(*r)
+ end
+
+ def tree(depth)
+ # This duparray is our leaf-gc target.
+ return [nil, nil] unless depth > 0
+
+ # Modify the local and pass it to the following calls.
+ depth -= 1
+ [tree(depth), tree(depth)]
+ end
+
+ def test
+ GC.stress = true
+ 2.times do
+ t = tree(11)
+ check(*t)
+ end
+ :ok
+ end
+
+ test
+ }, call_threshold: 14, num_profiles: 5
+ end
+
private
# Assert that every method call in `test_script` can be compiled by ZJIT