summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorRandy Stauner <randy@r4s6.net>2026-01-14 11:02:51 -0700
committerGitHub <noreply@github.com>2026-01-14 10:02:51 -0800
commit33cae95c8afce2782c2808a8e74c81d9ac763a4e (patch)
treed1e205018b09867d18e82ee6df076ca0ea77eecf /bootstraptest
parent3176790c0d15dd7a72bb6e349651b3a66111d6f7 (diff)
[Backport #21832] Add pushtoarray insn to fix segfault with forwarding + splat (#15870)ruby_4_0
Add pushtoarray insn to fix segfault with forwarding + splat Example insns diff for `def x = [3]; def a(...) = b(*x, 2, 3, ...)` == disasm: #<ISeq:a@-e:1 (1,13)-(1,42)> local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) [ 1] "..."@0 0000 putself ( 1)[Ca] 0000 putself 0000 opt_send_without_block <calldata!mid:x, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0000 splatarray true 0000 putobject 2 0000 putobject 3 +0000 pushtoarray 2 0000 getlocal_WC_0 "..."@0 0000 sendforward <calldata!mid:b, argc:1, ARGS_SPLAT|ARGS_SPLAT_MUT|FCALL|FORWARDING>, nil 0000 leave [Re] This matches the insns produced by parse.y
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_method.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index 997675200e..78aab73485 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -1427,3 +1427,10 @@ assert_equal 'ok', <<~RUBY
test
RUBY
+
+assert_equal '[1, 2, 3]', %q{
+ def target(*args) = args
+ def x = [1]
+ def forwarder(...) = target(*x, 2, ...)
+ forwarder(3).inspect
+}, '[Bug #21832] post-splat args before forwarding'