Project

General

Profile

Actions

Bug #20799

closed

Bug in forwarding to struct methods

Added by tenderlovemaking (Aaron Patterson) 2 months ago. Updated 2 months ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-10-15T18:34:24Z master f45eb3dcb9) +PRISM [arm64-darwin24]
[ruby-core:119533]

Description

This program crashes:

Thing = Struct.new(:value)

Obj = Thing.new("ok")

def delegate(...)
  Obj.value(...)
end

def no_args
  delegate
end

def splat_args(*args)
  delegate(*args)
end

no_args
splat_args

It's crashing because we're forwarding to a struct method without taking in to account the forwarding IC. I have a patch prepared, but I am filing this ticket to track it.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20865: `Stack consistency error` running ActiveSupport testClosedActions
Actions #1

Updated by tenderlovemaking (Aaron Patterson) 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|a0ecdbfbfe57a57ab33bdb5e1de4d5dfa8407dbb.


Remove "simple" flag from forwarded ICs

I don't think we should ever consider forwarded IC's to be "simple".
Previously, the "simple" flag would be copied to the derived IC and this
happened to cause struct set / get iseqs to write an invalid CC
fastpath:

https://github.com/tenderlove/ruby/blob/f45eb3dcb9c7d849064cb802953f37e1cf9f3996/vm_insnhelper.c#L4726-L4729

[Bug #20799]

Actions #2

Updated by byroot (Jean Boussier) 2 months ago

  • Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
Actions #3

Updated by byroot (Jean Boussier) about 2 months ago

  • Related to Bug #20865: `Stack consistency error` running ActiveSupport test added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0