From: "steviejj (Steven Johnstone) via ruby-core" Date: 2026-11-30T20:10:02+00:00 Subject: [ruby-core:127770] [Ruby Bug#22658] `iseq_set_sequence: adjust bug 0 < 1` compiling `case when f; while _ && break; end; end` Issue #22658 has been reported by steviejj (Steven Johnstone). ---------------------------------------- Bug #22658: `iseq_set_sequence: adjust bug 0 < 1` compiling `case when f; while _ && break; end; end` https://bugs.ruby-lang.org/issues/22658 * Author: steviejj (Steven Johnstone) * Status: Open * ruby -v: ruby 4.1.0dev (2026-11-30T19:32:44Z HEAD 2fd27c959d) +PRISM [aarch64-linux] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Compiling a `while` or `until` loop whose condition contains `&& break` directly inside a `case` `when` branch fails during YARV ISeq assembly (`iseq_set_sequence` in `compile.c`) with `iseq_set_sequence: adjust bug 0 < 1`. Reproduces on CRuby `ruby 4.1.0dev (2026-11-30T19:32:44Z HEAD 2fd27c959d) +PRISM [aarch64-linux]` with default compiler options on both `--parser=prism` and `--parser=parse.y`. #### Reproducer ```bash ruby --parser=prism -e 'case when f; while _ && break; end; end' ruby --parser=parse.y -e 'case when f; while _ && break; end; end' ``` (`until` also reproduces: `case when f; until _ && break; end; end`.) Notice that `while _ && break; end` alone and `if f; while _ && break; end; end` both compile cleanly; the failure specifically requires the `case`/`when` wrapper. #### Observed Output Both `--parser=prism` and `--parser=parse.y` dump raw disassembly and fail with a `SyntaxError`: ```text -- raw disasm-------- trace: 1 0000 putself ( 1) 0001 opt_send_without_block ( 1) 0003 branchif ( 1) 0005 putnil ( 1) 0006 leave ( 1) 0007 jump ( 1) [sp: 1, unremovable: 1, refcnt: 1] 0009 putnil ( 1) [sp: 2, unremovable: 0, refcnt: 1] 0010 pop ( 1) [sp: 1, unremovable: 1, refcnt: 7] [sp: 0, unremovable: 0, refcnt: 3] 0011 putself ( 1) 0012 opt_send_without_block ( 1) 0014 branchunless ( 1) [sp: 0, unremovable: 1, refcnt: 1] * adjust: [label: 3] 0016 putnil ( 1) 0017 leave ( 1) adjust: [label: 15] 0018 jump ( 1) adjust: [label: 6] 0020 putnil ( 1) [sp: -1, unremovable: 0, refcnt: 4] 0021 leave ( 1) --------------------- -e:1: iseq_set_sequence: adjust bug 0 < 1 -e: compile error (SyntaxError) ``` -- 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/lists/ruby-core.ml.ruby-lang.org/