Project

General

Profile

Actions

Bug #20159

closed

Prism assertion failure even if it is executed with --parser=parse.y

Added by tompng (tomoya ishida) 4 months ago. Updated 4 months ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-01-07T16:23:58Z master 8b86d6f0c1) [x86_64-linux]
[ruby-core:116063]

Description

Prism fails to parse this code with assertion failed. Reported at https://github.com/ruby/prism/issues/1616

<<A+%
A

Ruby exits with assertion failed even if it's run with option --parser=parse.y

# ruby -v
ruby 3.4.0dev (2024-01-07T16:23:58Z master 8b86d6f0c1) [x86_64-linux]
# (echo "<<A+%"; echo "A") > a.rb
# ruby --parser=parse.y a.rb
ruby: prism/util/pm_newline_list.c:42: pm_newline_list_append: Assertion `list->size == 0 || newline_offset > list->offsets[list->size - 1]' failed.
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

eval will correclty result in SyntaxError, require and load exits with assertion failed.

# irb
irb(main):001> eval File.read('a.rb')
(irb):1:in `eval': (eval at (irb):1):1: unterminated string meets end of file (SyntaxError)
irb(main):002> load 'a.rb'
prism/util/pm_newline_list.c:42: pm_newline_list_append: Assertion `list->size == 0 || newline_offset > list->offsets[list->size - 1]' failed.
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0