This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
restore PL_tmps_floor on exit
authorDavid Mitchell <davem@iabyn.com>
Wed, 28 Oct 2015 08:28:56 +0000 (08:28 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:18:32 +0000 (09:18 +0000)
A couple of places were expecting dounwind(-1); LEAVE_SCOPE(0);
to restore PL_tmps_floor, since its old value was saved on the savestack.
Since that's now stored in the context struct instead, do
a POPBLOCK(&cxstack[0]).

This problem only showed up on 'make test' rather than 'make
test_harness', since only the former sets PERL_DESTRUCT_LEVEL.

ext/XS-APItest/APItest.xs
perl.c

index 51924a8..16a7753 100644 (file)
@@ -3725,11 +3725,10 @@ CODE:
     PERL_SET_CONTEXT(interp);
 
     POPSTACK_TO(PL_mainstack);
+    assert(cxstack_ix >= 0);
     dounwind(-1);
+    POPBLOCK(cxstack);
     LEAVE_SCOPE(0);
-
-    while (interp->Iscopestack_ix > 1)
-        LEAVE;
     FREETMPS;
 
     perl_destruct(interp);
diff --git a/perl.c b/perl.c
index ab8f012..beb9d63 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -5080,7 +5080,10 @@ S_my_exit_jump(pTHX)
     }
 
     POPSTACK_TO(PL_mainstack);
-    dounwind(-1);
+    if (cxstack_ix >= 0) {
+        dounwind(-1);
+        POPBLOCK(cxstack);
+    }
     LEAVE_SCOPE(0);
 
     JMPENV_JUMP(2);