Patch from Enache for the crashing of bytecode.t in Tru64.
Jarkko Hietaniemi [Wed, 20 Aug 2003 10:49:51 +0000 (10:49 +0000)]
p4raw-id: //depot/perl@20789

ext/B/B/Bytecode.pm
ext/ByteLoader/bytecode.h

index 826ae5b..8580885 100644 (file)
@@ -358,7 +358,7 @@ sub B::AV::bsave {
 
     nice "-AV-",
     asm "ldsv", $varix = $ix unless $ix == $varix;
-    asm "av_extend", $av->MAX;
+    asm "av_extend", $av->MAX if $av->MAX >= 0;
     asm "av_pushx", $_ for @array;
     asm "sv_refcnt", $av->REFCNT;
     asm "xav_flags", $av->AvFLAGS;
index a9de88f..8ca9382 100644 (file)
@@ -171,10 +171,17 @@ typedef char *pvindex;
 
 
 #define BSET_newsv(sv, arg)                            \
-       STMT_START {                                    \
-           sv = NEWSV(0,0);                            \
-           SvUPGRADE(sv, (arg));                       \
-       } STMT_END
+           switch(arg) {                               \
+           case SVt_PVAV:                              \
+               sv = (SV*)newAV();                      \
+               break;                                  \
+           case SVt_PVHV:                              \
+               sv = (SV*)newHV();                      \
+               break;                                  \
+           default:                                    \
+               sv = NEWSV(0,0);                        \
+               SvUPGRADE(sv, (arg));                   \
+           }
 #define BSET_newsvx(sv, arg) STMT_START {              \
            BSET_newsv(sv, arg &  SVTYPEMASK);          \
            SvFLAGS(sv) = arg;                          \