[ruby-cvs:78798] 75acbd5f00 (master): compile.c: avoid newarraykwsplat for arguments

"Yusuke Endoh" <[email protected]> Sun, 22 Dec 2019 03:35:36 +0900 (JST)
Newsgroups gmane.comp.lang.ruby.cvs
Message-ID <[email protected]>
Yusuke Endoh	2019-12-22 03:31:27 +0900 (Sun, 22 Dec 2019)

  New Revision: 75acbd5f00

  https://github.com/ruby/ruby/commit/75acbd5f00

  Log:
    compile.c: avoid newarraykwsplat for arguments
    
    `foo(*rest, post, **empty_kw)` is compiled like
    `foo(*rest + [post, **empty_kw])`, and `**empty_kw` is removed by
    "newarraykwsplat" instruction.
    However, the method call still has a flag of KW_SPLAT, so "post" is
    considered as a keyword hash, which caused a segfault.
    Note that the flag cannot be removed if "empty_kw" is not always empty.
    
    This change fixes the issue by compiling arguments with "newarray"
    instead of "newarraykwsplat".
    
    [Bug #16442]

  Modified files:
    compile.c
    test/ruby/test_keyword.rb