This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_leaveeval: reset stack in VOID context
authorDavid Mitchell <davem@iabyn.com>
Fri, 16 Oct 2015 12:31:57 +0000 (13:31 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:45 +0000 (08:59 +0000)
commit2aabfe8a6165874dd6373e006f0e80d74d5f602c
treea4cb777b2e646096a6e15276ba67a52a1945724d
parent9aba0c93f90eae29f42bd1b63c0079b8c7f4e364
pp_leaveeval: reset stack in VOID context

    $ perl -Dst -e'eval"1"'

Gives:
    ....
    ((eval 1):1) leaveeval
        =>  (FREED)

Change it so that like all the other pp_leavefoo() functions, it does

    if (gimme == G_VOID)
        PL_stack_sp = newsp;

I can't think of any (non-debugging) perl-level badness the old behaviour
can be shown to demonstrate, but best not to have freed values left
dangling.

This also allows pp_leaveeval() to (like the other pp_leavefoo functions)
avoid doing a dSP with the associated unnecessary PUTBACKs and SPAGAINs.

Finally, the code to detect a false require is moved to earlier in the
function where it's in the same place as the rest of the stack arg
processing code.
ext/XS-APItest/t/call.t
pp_ctl.c