@@ -400,11 +400,13 @@ int re_comp(rcode *prog, const char *re, int nsubs)
400400icnt ++ ;
401401break ;
402402case SPLIT :
403- prog -> insts [i ++ ]= scnt ++ ;
403+ prog -> insts [i ++ ]= scnt ;
404+ scnt += 2 ;
404405icnt ++ ;
405406break ;
406407case RSPLIT :
407- prog -> insts [i ]= - scnt ++ ;
408+ prog -> insts [i ]= - scnt ;
409+ scnt += 2 ;
408410case JMP :
409411case SAVE :
410412case CHAR :
@@ -415,7 +417,7 @@ int re_comp(rcode *prog, const char *re, int nsubs)
415417prog -> insts [prog -> unilen ++ ]= SAVE ;
416418prog -> insts [prog -> unilen ++ ]= prog -> sub + 1 ;
417419prog -> insts [prog -> unilen ++ ]= MATCH ;
418- prog -> splits = scnt ;
420+ prog -> splits = ( scnt - SPLIT ) / 2 + SPLIT ;
419421prog -> len = icnt + 2 ;
420422return RE_SUCCESS ;
421423}
@@ -437,11 +439,12 @@ if (--csub->ref == 0) { \
437439
438440#define onclist (nn )
439441#define onnlist (nn ) \
440- if (sparse [spc] < sparsesz) \
441- if (sdense[sparse [spc]] == spc) \
442+ if (sdense [spc+1 ] < sparsesz) \
443+ if (sdense[sdense [spc+1 ]] ==(unsigned int) spc) \
442444deccheck(nn) \
445+ sdense[spc+1] = sparsesz; \
443446sdense[sparsesz] = spc; \
444- sparse[spc] = sparsesz++ ; \
447+ sparsesz += 2 ; \
445448
446449#define fastrec (nn ,list ,listidx ) \
447450nsub->ref++; \
@@ -545,11 +548,11 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
545548{
546549int rsubsize = sizeof (rsub )+ (sizeof (char * )* nsubp );
547550int si ,i ,j ,c ,suboff = rsubsize ,* npc ,osubp = nsubp * sizeof (char * );
548- int clistidx = 0 ,nlistidx ,sparsesz , spc ,mcont = MATCH ;
551+ int clistidx = 0 ,nlistidx ,spc ,mcont = MATCH ;
549552const char * sp = s ,* _sp = s ;
550553int * insts = prog -> insts ;
551554int * pcs [prog -> splits ];
552- unsignedint sdense [prog -> splits ],sparse [ prog -> splits ] ;
555+ unsignedint sdense [prog -> splits * 2 ],sparsesz ;
553556rsub * subs [prog -> splits ];
554557char nsubs [rsubsize * (prog -> len - prog -> splits + 14 )];
555558rsub * nsub ,* s1 ,* matched = NULL ,* freesub = NULL ;
@@ -560,7 +563,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
560563for (;;sp = _sp ) {
561564uc_len (i ,sp )uc_code (c ,sp )
562565_sp = sp + i ;
563- nlistidx = 0 ;sparsesz = 0 ;
566+ nlistidx = 0 ;sparsesz = SPLIT ;
564567for (i = 0 ;i < clistidx ;i ++ ) {
565568npc = clist [i ].pc ;
566569nsub = clist [i ].sub ;