This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[win32] merge a maint patch
authorGurusamy Sarathy <gsar@cpan.org>
Wed, 11 Feb 1998 00:15:51 +0000 (19:15 -0500)
committerGurusamy Sarathy <gsar@cpan.org>
Thu, 12 Feb 1998 02:47:29 +0000 (02:47 +0000)
Message-Id: <199802110515.AAA23700@aatma.engin.umich.edu>
Subject: Re: "local" can crash perl-4.00[34] on Solaris-x86 & FreeBSD

p4raw-id: //depot/win32/perl@497

pp_ctl.c
t/op/local.t

index a4135c6..33247e3 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1011,7 +1011,7 @@ dounwind(I32 cxix)
     while (cxstack_ix > cxix) {
        cx = &cxstack[cxstack_ix];
        DEBUG_l(PerlIO_printf(Perl_debug_log, "Unwinding block %ld, type %s\n",
-                             (long) cxstack_ix+1, block_type[cx->cx_type]));
+                             (long) cxstack_ix, block_type[cx->cx_type]));
        /* Note: we don't need to restore the base context info till the end. */
        switch (cx->cx_type) {
        case CXt_SUBST:
@@ -1347,8 +1347,9 @@ PP(pp_enteriter)
        SAVESPTR(*svp);
     }
     else {
-       svp = &GvSV((GV*)POPs);                 /* symbol table variable */
-       SAVESPTR(*svp);
+       GV *gv = (GV*)POPs;
+       (void)save_scalar(gv);
+       svp = &GvSV(gv);                        /* symbol table variable */
     }
 
     ENTER;
index 3e30306..a034539 100755 (executable)
@@ -2,7 +2,7 @@
 
 # $RCSfile: local.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:04 $
 
-print "1..24\n";
+print "1..25\n";
 
 sub foo {
     local($a, $b) = @_;
@@ -58,3 +58,13 @@ $a = 'outer';
 if (1) { local $a = 'inner' }
 print +($a eq 'outer') ? "" : "not ", "ok 24\n";
 
+# see if localization works when scope unwinds
+
+local $m = 5;
+eval {
+    for $m (6) {
+       local $m = 7;
+       die "bye";
+    }
+};
+print $m == 5 ? "" : "not ", "ok 25\n";