This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
RT #128255: Assert fail in S_sublex_done
authorDavid Mitchell <davem@iabyn.com>
Fri, 8 Jul 2016 08:48:04 +0000 (09:48 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 8 Jul 2016 08:48:04 +0000 (09:48 +0100)
Some code that handles deprecated behaviour in formats was triggering
an assertion. This:

    format STDOUT =
    @
    0"$x"

gave this warning:

    Use of comma-less variable list is deprecated

but then gave this panic:

    toke.c:2457: S_sublex_done: Assertion `(PL_parser->lex_inwhat) ==
     OP_SUBST || (PL_parser->lex_inwhat) == OP_TRANS' failed.

This is due to the lexer calling scan_str(), then backing off and doing
the warning and returning a comma, then on the next token get, calling
scan_str() again. Because scan_str() has been called twice, the
second time it extracts the string to PL_sublex_info.repl rather than
PL_lex_stuff, as it does with things like s/foo/bar/ and tr/abc/ABC/.
Later an assert that PL_sublex_info.repl is only set for a s/// or tr///
fails.

The solution seems to be to check and return a comma *before*
trying to call scan_str().


No differences found