Project

General

Profile

Actions

Bug #22658

open

`iseq_set_sequence: adjust bug 0 < 1` compiling `case when f; while _ && break; end; end`

Bug #22658: `iseq_set_sequence: adjust bug 0 < 1` compiling `case when f; while _ && break; end; end`

Added by steviejj (Steven Johnstone) about 4 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-11-30T19:32:44Z HEAD 2fd27c959d) +PRISM [aarch64-linux]
[ruby-core:127770]

Description

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

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:

-- raw disasm--------
   trace: 1
   0000 putself                                                          (   1)
   0001 opt_send_without_block <calldata:f, 0>                           (   1)
   0003 branchif             <L002>                                      (   1)
   0005 putnil                                                           (   1)
   0006 leave                                                            (   1)
   0007 jump                 <L002>                                      (   1)
 <L006> [sp: 1, unremovable: 1, refcnt: 1]
   0009 putnil                                                           (   1)
 <L007> [sp: 2, unremovable: 0, refcnt: 1]
   0010 pop                                                              (   1)
 <L003> [sp: 1, unremovable: 1, refcnt: 7]
 <L002> [sp: 0, unremovable: 0, refcnt: 3]
   0011 putself                                                          (   1)
   0012 opt_send_without_block <calldata:_, 0>                           (   1)
   0014 branchunless         <L003>                                      (   1)
 <L015> [sp: 0, unremovable: 1, refcnt: 1]
*  adjust: [label: 3]
   0016 putnil                                                           (   1)
   0017 leave                                                            (   1)
   adjust: [label: 15]
   0018 jump                 <L003>                                      (   1)
   adjust: [label: 6]
   0020 putnil                                                           (   1)
 <L004> [sp: -1, unremovable: 0, refcnt: 4]
   0021 leave                                                            (   1)
---------------------
-e:1: iseq_set_sequence: adjust bug 0 < 1
-e: compile error (SyntaxError)

No data to display

Actions

Also available in: PDF Atom