This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don’t crash with ()=&CORE::srand
authorFather Chrysostomos <sprout@cpan.org>
Sun, 24 Jun 2012 18:14:29 +0000 (11:14 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 24 Jun 2012 18:14:29 +0000 (11:14 -0700)
commit0a5f3363e275bb35c4f20083e44a319e37d56898
treea425cbe153822000d2b471488a0cc1de4fd51b8f
parent61a3fb803c3babf0e3e750430415338e6506a241
Don’t crash with ()=&CORE::srand

Ops that don’t allow arbitrarily long argument lists are flagged at compile-time with the number of children.

Coresubs have to call the same op with differing numbers of arguments,
so they push nulls on to the stack to make up the number of items the
pp function expects to pop.

Commit f914a6829 stopped popping the null of the stack.

Before:
$ ./perl -le 'print &CORE::srand'
1240765685

After:
$ ./perl -le 'print &CORE::srand'
Bus error

List assignment does the same thing, and makes it easier to
write a test.
pp.c
t/op/coreamp.t