From: "kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core" Date: 2023-04-26T07:28:26+00:00 Subject: [ruby-core:113346] [Ruby master Bug#19611] Ruby hangs up with `while true && true` Issue #19611 has been updated by kjtsanaktsidis (KJ Tsanaktsidis). After my patch, the instruction sequence for this method is: ``` == disasm: #@:1 (1,0)-(1,23)> 0000 jump 4 ( 1)[Li] 0002 putnil 0003 pop 0004 jump 4 0006 putnil 0007 leave ``` which will loop forever, as expected. This code isn't optimal though. A second pass of the peephole optimizer would reduce this down to this I think - ``` 0000 putnil 0001 jump 1 0003 leave ``` but I guess optimizing something which is guaranteed to contain an infinite loop probably isn't worth doing? ---------------------------------------- Bug #19611: Ruby hangs up with `while true && true` https://bugs.ruby-lang.org/issues/19611#change-102906 * Author: tompng (tomoya ishida) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin20] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Fails to run this code. It hangs up. Ctrl+C does not work. ~~~ruby def hoge while true && true end end ~~~ Compiling `while true && true; end` will also hangs up ~~~ruby irb(main):001:0> RubyVM::InstructionSequence.compile 'while true && true; end'; puts :done (no response) ~~~ -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/