Project

General

Profile

Actions

Bug #11663

closed

Segfault when using multiple keywords if the first keyword is invalid

Added by smacgahan (Sean MacGahan) about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:71356]

Description

When loading a method with an invalid keyword (such as one that ends in a question mark), a syntax error occurs as is expected. However, when loading a method with multiple keywords, if the first keyword is invalid then a segmentation fault occurs.

def foo(arg1?:) end         #=> syntax error
def foo(arg1?:, arg2) end   #=> syntax error (tIDENTIFIER as expected)
def foo(arg1:) end          #=> no syntax error
def foo(arg1:, arg2?:) end  #=> syntax error
def foo(arg1, arg2?:) end   #=> syntax error

def foo(arg1?:, arg2:) end  #=> segfault
def foo(arg1?:, arg2?:) end #=> segfault

Related issues

Related to Ruby master - Feature #10440: Optimize keyword and splat argumentClosedko1 (Koichi Sasada)10/28/2014Actions
Related to Ruby master - Bug #10545: SEGV: def m(A: a) endClosed11/26/2014Actions
Actions

Also available in: Atom PDF