Actions
Bug #21085
closed[BUG] Stack consistency error with -ne
Description
Running the following crashes for me
echo '' | ruby -ne ''
Attached the diagnostic report as requested
Files
Updated by ufuk (Ufuk Kayserilioglu) 2 days ago
This succeeds with the parse.y
parser, so it seems to be a Prism compiler bug:
❯ echo '' | ruby --parser=parse.y -vne ''
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) [arm64-darwin23]
❯ echo '' | ruby --parser=prism -vne ''
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin23]
-e:1: [BUG] Stack consistency error (sp: 7, bp: 6)
...
Updated by segiddins (Samuel Giddins) 2 days ago
Good catch.
❯ ruby --dump=insns -vne '' --parser=parse.y
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) [arm64-darwin24]
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,0)>
0000 jump 4 ( 1)
0002 putnil
0003 pop
0004 putself
0005 getglobal :$/
0007 opt_send_without_block <calldata!mid:gets, argc:1, FCALL|ARGS_SIMPLE>
0009 branchif 4
0011 putnil
0012 leave
❯ ruby --dump=insns -vne '' --parser=prism
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,0)>
0000 jump 7 ( 1)[Li]
0002 putnil
0003 pop
0004 jump 7
0006 putnil
0007 putself
0008 getglobal :$/
0010 opt_send_without_block <calldata!mid:gets, argc:1, FCALL|ARGS_SIMPLE>
0012 branchif 6
0014 putnil
0015 leave
Updated by kddnewton (Kevin Newton) 1 day ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: REQUIRED
Updated by kddnewton (Kevin Newton) 1 day ago
- Status changed from Open to Closed
Applied in changeset git|241ada7b1ca4fd71dc47a83d912ee25162a555d9.
[ruby/prism] Do not put empty statements in while because of -n
Fixes [Bug #21085]
Actions
Like0
Like0Like0Like0Like0Like0