bob@dhw68k.cts.com (Bob Best) (07/14/88)
The following patches were applied to perl2 (patchlevel 6) to avoid the Xenix 386 v2.2.2 'internal compiler infinite spill' errors generated during compilation. The resulting perl has successfully completed the entire test suite. Index: arg.c *** arg.c~ --- arg.c ************** *** 146,151 gotcha: if (retary && curspat == spat) { int iters, i, len; iters = spat->spat_regexp->nparens; *ptrmaxsarg = iters + sargoff; --- 146,153 ----- gotcha: if (retary && curspat == spat) { int iters, i, len; + int tmpint; + char *tmpptr; iters = spat->spat_regexp->nparens; *ptrmaxsarg = iters + sargoff; ************** *** 149,156 iters = spat->spat_regexp->nparens; *ptrmaxsarg = iters + sargoff; ! sarg = (STR**)saferealloc((char*)(sarg - sargoff), ! (iters+2+cushion+sargoff)*sizeof(STR*)) + sargoff; for (i = 1; i <= iters; i++) { sarg[i] = str_static(&str_no); --- 151,159 ----- iters = spat->spat_regexp->nparens; *ptrmaxsarg = iters + sargoff; ! tmpint=(iters+2+cushion+sargoff)*sizeof(STR*); ! tmpptr=(char *)(sarg-sargoff); ! sarg = (STR**)saferealloc(tmpptr, tmpint) + sargoff; for (i = 1; i <= iters; i++) { sarg[i] = str_static(&str_no); ************** *** 402,410 iters--; } if (retary) { ! *ptrmaxsarg = iters + sargoff; ! sarg = (STR**)saferealloc((char*)(sarg - sargoff), ! (iters+2+cushion+sargoff)*sizeof(STR*)) + sargoff; for (i = 1; i <= iters; i++) sarg[i] = afetch(ary,i-1); --- 405,412 ----- iters--; } if (retary) { ! int tmpint; ! char *tmpptr; *ptrmaxsarg = iters + sargoff; tmpint=(iters+2+cushion+sargoff)*sizeof(STR*); ************** *** 406,411 sarg = (STR**)saferealloc((char*)(sarg - sargoff), (iters+2+cushion+sargoff)*sizeof(STR*)) + sargoff; for (i = 1; i <= iters; i++) sarg[i] = afetch(ary,i-1); *retary = sarg; --- 408,417 ----- int tmpint; char *tmpptr; + *ptrmaxsarg = iters + sargoff; + tmpint=(iters+2+cushion+sargoff)*sizeof(STR*); + tmpptr=(char *)(sarg-sargoff); + sarg = (STR**)saferealloc(tmpptr, tmpint) + sargoff; for (i = 1; i <= iters; i++) sarg[i] = afetch(ary,i-1); *retary = sarg; ************** *** 815,822 max = (int)str_gnum(*tmpary); if (retary) { ! sarg = (STR**)saferealloc((char*)(sarg - sargoff), ! (max+2+cushion+sargoff)*sizeof(STR*)) + sargoff; for (i = 1; i <= max; i++) sarg[i] = tmpary[i]; *retary = sarg; --- 821,831 ----- max = (int)str_gnum(*tmpary); if (retary) { ! int tmpint; ! char *tmpptr; ! tmpint=(max+2+cushion+sargoff)*sizeof(STR*); ! tmpptr=(char *)(sarg-sargoff); ! sarg = (STR**)saferealloc(tmpptr, tmpint) + sargoff; for (i = 1; i <= max; i++) sarg[i] = tmpary[i]; *retary = sarg; ************** *** 903,908 max = 0; if (retary) { if (max) { apush(ary,str_nmake((double)statbuf.st_dev)); apush(ary,str_nmake((double)statbuf.st_ino)); --- 912,919 ----- max = 0; if (retary) { + int tmpint; + char *tmpptr; if (max) { apush(ary,str_nmake((double)statbuf.st_dev)); apush(ary,str_nmake((double)statbuf.st_ino)); ************** *** 924,931 #endif } *ptrmaxsarg = max + sargoff; ! sarg = (STR**)saferealloc((char*)(sarg - sargoff), ! (max+2+cushion+sargoff)*sizeof(STR*)) + sargoff; for (i = 1; i <= max; i++) sarg[i] = afetch(ary,i-1); *retary = sarg; --- 935,943 ----- #endif } *ptrmaxsarg = max + sargoff; ! tmpint=(max+2+cushion+sargoff)*sizeof(STR*); ! tmpptr=(char *)(sarg-sargoff); ! sarg = (STR**)saferealloc(tmpptr, tmpint) + sargoff; for (i = 1; i <= max; i++) sarg[i] = afetch(ary,i-1); *retary = sarg; ************** *** 1526,1531 apush(ary,str_make(str_get(hiterval(entry)))); } if (retary) { /* array wanted */ *ptrmaxsarg = max + sargoff; sarg = (STR**)saferealloc((char*)(sarg - sargoff), (max+2+cushion+sargoff)*sizeof(STR*)) + sargoff; --- 1538,1545 ----- apush(ary,str_make(str_get(hiterval(entry)))); } if (retary) { /* array wanted */ + int tmpint; + char *tmpptr; *ptrmaxsarg = max + sargoff; tmpint=(max+2+cushion+sargoff)*sizeof(STR*); tmpptr=(char *)(sarg-sargoff); ************** *** 1527,1534 } if (retary) { /* array wanted */ *ptrmaxsarg = max + sargoff; ! sarg = (STR**)saferealloc((char*)(sarg - sargoff), ! (max+2+cushion+sargoff)*sizeof(STR*)) + sargoff; for (i = 1; i <= max; i++) sarg[i] = afetch(ary,i-1); *retary = sarg; --- 1541,1549 ----- int tmpint; char *tmpptr; *ptrmaxsarg = max + sargoff; ! tmpint=(max+2+cushion+sargoff)*sizeof(STR*); ! tmpptr=(char *)(sarg-sargoff); ! sarg = (STR**)saferealloc(tmpptr, tmpint) + sargoff; for (i = 1; i <= max; i++) sarg[i] = afetch(ary,i-1); *retary = sarg; Index: eval.c *** eval.c~ --- eval.c ************** *** 73,78 maxsarg = maxarg = arg->arg_len; if (maxsarg > 3 || retary) { if (sargoff >= 0) { /* array already exists, just append to it */ cushion = 10; sarg = (STR **)saferealloc((char*)*retary, (maxsarg+sargoff+2+cushion) * sizeof(STR*)) + sargoff; --- 73,80 ----- maxsarg = maxarg = arg->arg_len; if (maxsarg > 3 || retary) { if (sargoff >= 0) { /* array already exists, just append to it */ + int tmpint; + char *tmpptr; cushion = 10; tmpint=(maxsarg+sargoff+2+cushion)*sizeof(STR*); tmpptr=(char*)*retary; ************** *** 74,81 if (maxsarg > 3 || retary) { if (sargoff >= 0) { /* array already exists, just append to it */ cushion = 10; ! sarg = (STR **)saferealloc((char*)*retary, ! (maxsarg+sargoff+2+cushion) * sizeof(STR*)) + sargoff; /* Note that sarg points into the middle of the array */ } else { --- 76,85 ----- int tmpint; char *tmpptr; cushion = 10; ! tmpint=(maxsarg+sargoff+2+cushion)*sizeof(STR*); ! tmpptr=(char*)*retary; ! sarg = (STR **)saferealloc(tmpptr, tmpint); ! sarg += sargoff; /* Note that sarg points into the middle of the array */ } else { ************** *** 327,332 sarg[anum] = str_static(sarg[anum]); anum++; if (anum > maxarg) { maxarg = anum + anum; maxsarg = maxarg + sargoff; sarg = (STR **)saferealloc((char*)(sarg-sargoff), --- 331,338 ----- sarg[anum] = str_static(sarg[anum]); anum++; if (anum > maxarg) { + int tmpint; + char *tmpptr; maxarg = anum + anum; maxsarg = maxarg + sargoff; tmpint=(maxsarg+2+cushion)*sizeof(STR*); ************** *** 329,336 if (anum > maxarg) { maxarg = anum + anum; maxsarg = maxarg + sargoff; ! sarg = (STR **)saferealloc((char*)(sarg-sargoff), ! (maxsarg+2+cushion) * sizeof(STR*)) + sargoff; } goto keepgoing; } --- 335,344 ----- char *tmpptr; maxarg = anum + anum; maxsarg = maxarg + sargoff; ! tmpint=(maxsarg+2+cushion)*sizeof(STR*); ! tmpptr=(char *)(sarg-sargoff); ! sarg = (STR **)saferealloc(tmpptr, tmpint); ! sarg += sargoff; } goto keepgoing; } ************** *** 666,673 maxarg = ary->ary_fill; maxsarg = maxarg + sargoff; if (retary) { /* array wanted */ ! sarg = (STR **)saferealloc((char*)(sarg-sargoff), ! (maxsarg+3+cushion)*sizeof(STR*)) + sargoff; for (anum = 0; anum <= maxarg; anum++) { sarg[anum+1] = str = afetch(ary,anum); } --- 674,685 ----- maxarg = ary->ary_fill; maxsarg = maxarg + sargoff; if (retary) { /* array wanted */ ! int tmpint; ! char *tmpptr; ! tmpint=(maxsarg+3+cushion)*sizeof(STR*); ! tmpptr=(char *)(sarg-sargoff); ! sarg = (STR **)saferealloc(tmpptr, tmpint); ! sarg += sargoff; for (anum = 0; anum <= maxarg; anum++) { sarg[anum+1] = str = afetch(ary,anum); } -- Bob Best uucp: ...{trwrb,hplabs}!felix!dhw68k!bob InterNet: bob@dhw68k.cts.com