This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
crash on explicit return from s///e
authorDavid Mitchell <davem@iabyn.com>
Mon, 28 Nov 2016 08:03:49 +0000 (08:03 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 28 Nov 2016 08:09:56 +0000 (08:09 +0000)
commit7332835e5da7b7a793ef814a84e53003be1d0138
tree13ec718d8fd948831c7139b55d480cae85e4d9ac
parent32458de9a4322bd2e66c525d33720a42df7e0b56
crash on explicit return from s///e

RT #130188

In

    sub f {
        my $x = 'a';
        $x =~ s/./return;/e;
    }

the 'return' triggers popping any contexts above the subroutine context:
in this case, a CXt_SUBST context. In this case, Perl_dounwind() calls
cx_popblock() for the bottom-most popped context, to restore any saved
vars. However, CXt_SUBST is the one context type which *doesn't* use
'struct block' as part of its context struct union, so you can't
cx_popblock() a CXt_SUBST context.

This commit makes it skip the cx_popblock() in this case.

Bug was introduced by me with v5.23.7-235-gfc6e609.
pp_ctl.c
t/re/subst.t