[#108552] [Ruby master Bug#18782] Race conditions in autoload when loading the same feature with multiple threads. — "ioquatix (Samuel Williams)" <noreply@...>
Issue #18782 has been reported by ioquatix (Samuel Williams).
11 messages
2022/05/14
[ruby-core:108693] [Ruby master Bug#18804] Invalid number for putnil instruction
From:
"hurricup (Alexandr Evstigneev)" <noreply@...>
Date:
2022-05-25 09:22:33 UTC
List:
ruby-core #108693
Issue #18804 has been reported by hurricup (Alexandr Evstigneev).
----------------------------------------
Bug #18804: Invalid number for putnil instruction
https://bugs.ruby-lang.org/issues/18804
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Looks like this is a pretty old bug. Consider example:
```
def foo1
if true
nil
else
1
end
end
def foo2
if true
42
else
1
end
end
foo1_method = method(:foo1)
puts RubyVM::InstructionSequence.of(foo1_method).disasm
foo2_method = method(:foo2)
puts RubyVM::InstructionSequence.of(foo2_method).disasm
```
Gives us:
```
== disasm: #<ISeq:foo1@/home/hurricup/RubymineProjects/untitled28/test.rb:1 (1,0)-(7,3)> (catch: FALSE)
0000 putnil ( 2)[LiCa]
0001 leave ( 7)[Re]
== disasm: #<ISeq:foo2@/home/hurricup/RubymineProjects/untitled28/test.rb:9 (9,0)-(15,3)> (catch: FALSE)
0000 putobject 42 ( 11)[LiCa]
0002 leave ( 15)[Re]
```
`putnil` has line set to 2 (and it should be 3)
`putobject 42` has line set to 11 and this is correct one.
User unable to put a breakpoint to the nil in debugger because of this.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>