Update the assertion to a croak "Out of range special SV number"
Nicholas Clark [Sat, 15 Apr 2006 20:54:44 +0000 (20:54 +0000)]
to give ByteLoader more meaningful failure diagnostics.

p4raw-id: //depot/perl@27822

ext/ByteLoader/bytecode.h

index 1d06b08..3e6f9d9 100644 (file)
@@ -91,9 +91,11 @@ typedef char *pvindex;
        arg = arg ? savepv(arg) : arg;                  \
     } STMT_END
 
-#define BSET_ldspecsv(sv, arg) STMT_START {                              \
-       assert(arg < sizeof(specialsv_list) / sizeof(specialsv_list[0])); \
-       sv = specialsv_list[arg];                                         \
+#define BSET_ldspecsv(sv, arg) STMT_START {                            \
+       if(arg >= sizeof(specialsv_list) / sizeof(specialsv_list[0])) { \
+           Perl_croak(aTHX_ "Out of range special SV number %d", arg); \
+       }                                                               \
+       sv = specialsv_list[arg];                                       \
     } STMT_END
 
 #define BSET_ldspecsvx(sv, arg) STMT_START {   \