Issue #19316 has been updated by alanwu (Alan Wu).
Here is a reproducer for 3.1.3:
```ruby
def foo(_, a, b, c)
a & b & ~c
end
n = 2 ** 64
args = [0, -n, n, n-1]
GC.stress = true
p foo(0, -n, n, n-1)
p foo(0, -n, n, n-1)
p foo(0, -n, n, n-1)
__END__
$ ruby-3.1.3/bin/ruby test.rb
18446744073709551616
18446744073709551616
18446744073709551616
$ ruby-3.1.3/bin/ruby --yjit-call-threshold=1 test.rb
18446744073709551616
18446744073709551616
-18446744073709551616
```
Patch:
```patch
diff --git a/yjit_codegen.c b/yjit_codegen.c
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -3638,6 +3638,8 @@ gen_send_iseq(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo
*ci, const r
if (leaf_builtin && !block && leaf_builtin->argc + 1 <=
NUM_C_ARG_REGS) {
ADD_COMMENT(cb, "inlined leaf builtin");
+ jit_prepare_routine_call(jit, ctx, REG0);
+
// Call the builtin func (ec, recv, arg1, arg2, ...)
mov(cb, C_ARG_REGS[0], REG_EC);
```
It passes `make check` for me locally when applied against the release tar ball.
----------------------------------------
Bug #19316: YJIT crash in 3.2.0
https://bugs.ruby-lang.org/issues/19316#change-101187
* Author: jdashton (J Daniel Ashton)
* Status: Closed
* Priority: Normal
* Assignee: yjit
* ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22]
* Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED
----------------------------------------
When I check out this commit from GitHub,
https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9… ,
and run the following command, `RUBYOPT="-v --yjit" bin/rspec
spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes.
Crash Report log file attached.
---Files--------------------------------
ruby-2023-01-06-091855.ips (21.6 KB)
--
https://bugs.ruby-lang.org/