For SAVEt_I16, save the value with the type.
Nicholas Clark [Sat, 20 Feb 2010 18:54:58 +0000 (18:54 +0000)]
scope.c
sv.c

diff --git a/scope.c b/scope.c
index 9f9da42..57c00b6 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -417,7 +417,9 @@ Perl_save_I16(pTHX_ I16 *intp)
 
     PERL_ARGS_ASSERT_SAVE_I16;
 
-    save_pushi32ptr(*intp, intp, SAVEt_I16);
+    SSCHECK(2);
+    SSPUSHPTR(intp);
+    SSPUSHUV(SAVEt_I16 | ((UV)*intp << 8));
 }
 
 void
@@ -1086,7 +1088,7 @@ Perl_leave_scope(pTHX_ I32 base)
 
        case SAVEt_I16:                         /* I16 reference */
            ptr = SSPOPPTR;
-           *(I16*)ptr = (I16)SSPOPINT;
+           *(I16*)ptr = (I16)(uv >> 8);
            break;
        case SAVEt_I8:                          /* I8 reference */
            ptr = SSPOPPTR;
diff --git a/sv.c b/sv.c
index c0f7ee3..3e0367b 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11559,7 +11559,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            TOPLONG(nss,ix) = longval;
            break;
        case SAVEt_I32:                         /* I32 reference */
-       case SAVEt_I16:                         /* I16 reference */
        case SAVEt_COP_ARYBASE:                 /* call CopARYBASE_set */
            ptr = POPPTR(ss,ix);
            TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
@@ -11584,6 +11583,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            ptr = POPPTR(ss,ix);
            TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
            /* Fall through */
+       case SAVEt_I16:                         /* I16 reference */
        case SAVEt_I8:                          /* I8 reference */
        case SAVEt_BOOL:
            ptr = POPPTR(ss,ix);