Subject: port of /usr/src/lib/mip from 4.3BSD for use with lint Index: lib/mip 2.11BSD Description: 'lint' uses the machine independent part (mip) of the C compiler to do it's work. The version of the portable C compiler (pcc and mip) originally distributed with 2.11BSD (and several earlier) won't even successfully go thru the C compiler. The earlier pcc and mip sources aren't really useable with the current 2.11BSD C compiler (which isn't based on 'pcc' as far as i can tell). Repeat-By: Examination of the code. Fix: The patches below are to be applied against the 4.3BSD 'mip' sources. These are present in /usr/src/lib/PORT/mip.tar.Z, if that PORT directory was removed for space savings it will have to be retrieved from the distribution tapes. To apply the following patch: 1) cd /usr/src/lib 2) rm mip/* 3) zcat PORT/mip.tar.Z | tar xf - 4) cd mip 5) patch < the_patch_below Before 'lint' can be built either the update/patch to the 'pcc' directory can be installed or the file "localdefs.h" can be extracted from /usr/src/lib/PORT/pcc.tar.Z and installed in the 'pcc' directory. ------------------------------------------------------------------------- diff -c mip.vax/allo.c mip/allo.c *** mip.vax/allo.c Sat Jan 11 14:46:12 1986 --- mip/allo.c Sat Aug 17 16:33:22 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)allo.c 4.8 (Berkeley) 1/8/86"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)allo.c 4.8 (Berkeley) 1/8/86"; #endif lint *************** *** 34,40 **** # ifndef ALLO allo( p, q ) NODE *p; struct optab *q; { ! register n, i, j; int either; --- 34,40 ---- # ifndef ALLO allo( p, q ) NODE *p; struct optab *q; { ! OFFSZ freetemp(); register n, i, j; int either; *************** *** 117,129 **** } # endif ! extern unsigned int offsz; freetemp( k ){ /* allocate k integers worth of temp space */ /* we also make the convention that, if the number of words is more than 1, /* it must be aligned for storing doubles... */ # ifndef BACKTEMP ! int t; if( k>1 ){ SETOFF( tmpoff, ALDOUBLE ); --- 117,131 ---- } # endif ! extern OFFSZ offsz; ! ! OFFSZ freetemp( k ){ /* allocate k integers worth of temp space */ /* we also make the convention that, if the number of words is more than 1, /* it must be aligned for storing doubles... */ # ifndef BACKTEMP ! OFFSZ t; if( k>1 ){ SETOFF( tmpoff, ALDOUBLE ); *************** *** 424,430 **** qq = recres; ! if( rw&RLEFT) *qq++ = getlr( p, 'L' );; if( rw&RRIGHT ) *qq++ = getlr( p, 'R' ); if( rw&RESC1 ) *qq++ = &resc[0]; if( rw&RESC2 ) *qq++ = &resc[1]; --- 426,432 ---- qq = recres; ! if( rw&RLEFT) *qq++ = getlr( p, 'L' ); if( rw&RRIGHT ) *qq++ = getlr( p, 'R' ); if( rw&RESC1 ) *qq++ = &resc[0]; if( rw&RESC2 ) *qq++ = &resc[1]; diff -c mip.vax/cgram.y mip/cgram.y *** mip.vax/cgram.y Sun Aug 25 16:55:53 1985 --- mip/cgram.y Sat Aug 17 16:38:53 1991 *************** *** 380,386 **** if( blevel == 1 ) blevel = 0; clearst( blevel ); checkst( blevel ); ! autooff = *--psavbc; regvar = *--psavbc; } ; --- 380,386 ---- if( blevel == 1 ) blevel = 0; clearst( blevel ); checkst( blevel ); ! autooff = (unsigned)*--psavbc; regvar = *--psavbc; } ; *************** *** 390,396 **** if( blevel == 1 ) blevel = 0; clearst( blevel ); checkst( blevel ); ! autooff = *--psavbc; regvar = *--psavbc; } ; --- 390,396 ---- if( blevel == 1 ) blevel = 0; clearst( blevel ); checkst( blevel ); ! autooff = (unsigned)*--psavbc; regvar = *--psavbc; } ; *************** *** 819,825 **** return( q ); } ! dstash( n ){ /* put n into the dimension table */ if( curdim >= DIMTABSZ-1 ){ cerror( "dimension table overflow"); } --- 819,825 ---- return( q ); } ! dstash( n ) OFFSZ n;{ /* put n into the dimension table */ if( curdim >= DIMTABSZ-1 ){ cerror( "dimension table overflow"); } diff -c mip.vax/common.c mip/common.c *** mip.vax/common.c Sun Aug 25 16:55:53 1985 --- mip/common.c Sat Aug 3 15:07:11 1991 *************** *** 20,31 **** int nerrors = 0; /* number of errors */ ! extern unsigned int offsz; ! unsigned caloff(){ register i; ! unsigned int temp; ! unsigned int off; temp = 1; i = 0; do { --- 20,40 ---- int nerrors = 0; /* number of errors */ ! extern OFFSZ offsz; ! /* ! * this strangeness is due to offsets being measured in terms of bits ! * rather than bytes. normally "i=16" and "off=0100000" are returned, ! * but this is not enough to measure structures/arrays greater than ! * 32k bits (4kb). We return ! * the return value from this is multiplied by 8 (# bits/byte). ! */ ! ! OFFSZ caloff(){ register i; ! OFFSZ temp; ! OFFSZ off; ! #ifndef pdp11 temp = 1; i = 0; do { *************** *** 33,38 **** --- 42,50 ---- ++i; } while( temp != 0 ); off = 1 << (i-1); + #else + off = 02000000L; /* enough for 64kb */ + #endif return (off); } *************** *** 56,69 **** /* VARARGS1 */ cerror( s, a, b, c ) char *s; { /* compiler error: die */ where('c'); ! if( nerrors && nerrors <= 30 ){ /* give the compiler the benefit of the doubt */ fprintf( stderr, "cannot recover from earlier errors: goodbye!\n" ); - } - else { - fprintf( stderr, "compiler error: " ); - fprintf( stderr, s, a, b, c ); - fprintf( stderr, "\n" ); - } #ifdef BUFSTDERR fflush(stderr); #endif --- 68,78 ---- /* VARARGS1 */ cerror( s, a, b, c ) char *s; { /* compiler error: die */ where('c'); ! fprintf( stderr, "compiler error: " ); ! fprintf( stderr, s, a, b, c ); ! fprintf( stderr, "\n" ); ! if( nerrors && nerrors <= 30 ) /* give the compiler the benefit of the doubt */ fprintf( stderr, "cannot recover from earlier errors: goodbye!\n" ); #ifdef BUFSTDERR fflush(stderr); #endif *************** *** 213,219 **** int dope[ DSIZE ]; char *opst[DSIZE]; ! struct dopest { int dopeop; char opst[8]; int dopeval; } indope[] = { NAME, "NAME", LTYPE, STRING, "STRING", LTYPE, --- 222,228 ---- int dope[ DSIZE ]; char *opst[DSIZE]; ! struct dopest { int dopeop; char *opst; int dopeval; } indope[] = { NAME, "NAME", LTYPE, STRING, "STRING", LTYPE, *************** *** 341,348 **** # endif #ifdef FLEXNAMES ! #define NTSTRBUF 40 ! #define TSTRSZ 2048 char itstrbuf[TSTRSZ]; char *tstrbuf[NTSTRBUF] = { itstrbuf }; char **curtstr = tstrbuf; --- 350,357 ---- # endif #ifdef FLEXNAMES ! #define NTSTRBUF 25 /* was 40 */ ! #define TSTRSZ 512 /* was 2048 */ char itstrbuf[TSTRSZ]; char *tstrbuf[NTSTRBUF] = { itstrbuf }; char **curtstr = tstrbuf; diff -c mip.vax/config.h mip/config.h *** mip.vax/config.h Sun Aug 25 16:55:53 1985 --- mip/config.h Thu Aug 15 19:29:25 1991 *************** *** 20,31 **** /* * Table sizes. */ #define TREESZ 1000 /* parse tree table size */ #define BCSZ 100 /* break/continue table size */ ! #define SYMTSZ 3000 /* symbol table size */ ! #define DIMTABSZ 4200 /* dimension/size table size */ ! #define PARAMSZ 300 /* parameter stack size */ ! #define SWITSZ 500 /* switch table size */ #define DELAYS 20 /* delayed evaluation table size */ #define NRECUR (10*TREESZ) /* maximum eval recursion depth */ #define MAXSCOPES (SYMTSZ/30) /* maximum active scopes */ --- 20,35 ---- /* * Table sizes. */ + #ifndef FORT + #define TREESZ 300 + #else #define TREESZ 1000 /* parse tree table size */ + #endif #define BCSZ 100 /* break/continue table size */ ! #define SYMTSZ 800 /* symbol table size */ ! #define DIMTABSZ 990 /* dimension/size table size */ ! #define PARAMSZ 130 /* parameter stack size */ ! #define SWITSZ 210 /* switch table size */ #define DELAYS 20 /* delayed evaluation table size */ #define NRECUR (10*TREESZ) /* maximum eval recursion depth */ #define MAXSCOPES (SYMTSZ/30) /* maximum active scopes */ diff -c mip.vax/fort.c mip/fort.c *** mip.vax/fort.c Sun Aug 25 16:55:53 1985 --- mip/fort.c Sat Aug 17 16:43:19 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)fort.c 4.7 (Berkeley) 8/22/85"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)fort.c 4.7 (Berkeley) 8/22/85"; #endif lint *************** *** 91,99 **** # ifndef NOLCCOPY lccopy( n ) register n; { register i; ! static char fbuf[BUFSIZ]; if( n > 0 ){ ! if( n > BUFSIZ/4 ) cerror( "lccopy asked to copy too much" ); if( fread( fbuf, 4, n, lrd ) != n ) cerror( "intermediate file read error" ); for( i=4*n; fbuf[i-1] == '\0' && i>0; --i ) { /* VOID */ } if( i ) { --- 91,99 ---- # ifndef NOLCCOPY lccopy( n ) register n; { register i; ! static char fbuf[128]; if( n > 0 ){ ! if( n > sizeof(fbuf)/4 ) cerror( "lccopy asked to copy too much" ); if( fread( fbuf, 4, n, lrd ) != n ) cerror( "intermediate file read error" ); for( i=4*n; fbuf[i-1] == '\0' && i>0; --i ) { /* VOID */ } if( i ) { *************** *** 110,117 **** NODE * fstack[NSTACKSZ]; NODE ** fsp; /* points to next free position on the stack */ ! unsigned int offsz; ! unsigned int caloff(); mainp2( argc, argv ) char *argv[]; { int files; register long x; --- 110,117 ---- NODE * fstack[NSTACKSZ]; NODE ** fsp; /* points to next free position on the stack */ ! OFFSZ offsz; ! OFFSZ caloff(); mainp2( argc, argv ) char *argv[]; { int files; register long x; diff -c mip.vax/match.c mip/match.c *** mip.vax/match.c Sun Aug 25 16:55:53 1985 --- mip/match.c Sat Aug 17 16:44:24 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)match.c 4.4 (Berkeley) 8/22/85"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)match.c 4.4 (Berkeley) 8/22/85"; #endif lint diff -c mip.vax/optim.c mip/optim.c *** mip.vax/optim.c Sat Jan 11 14:46:13 1986 --- mip/optim.c Sat Aug 17 16:45:26 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)optim.c 4.7 (Berkeley) 1/8/86"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)optim.c 4.7 (Berkeley) 1/8/86"; #endif lint diff -c mip.vax/pass1.h mip/pass1.h *** mip.vax/pass1.h Sun Aug 25 16:55:54 1985 --- mip/pass1.h Sun Jul 28 17:31:03 1991 *************** *** 24,30 **** char sclass; /* storage class */ char slevel; /* scope level */ char sflags; /* flags, see below */ ! int offset; /* offset or value */ short dimoff; /* offset into the dimension table */ short sizoff; /* offset into the size table */ int suse; /* line number of last use of the variable */ --- 24,30 ---- char sclass; /* storage class */ char slevel; /* scope level */ char sflags; /* flags, see below */ ! OFFSZ offset; /* offset or value */ short dimoff; /* offset into the dimension table */ short sizoff; /* offset into the size table */ int suse; /* line number of last use of the variable */ *************** *** 124,138 **** extern double dcon; extern char ftitle[]; extern char ititle[]; extern struct symtab stab[]; extern int curftn; extern int curclass; extern int curdim; ! extern int dimtab[]; ! extern int paramstk[]; extern int paramno; ! extern int autooff, argoff, strucoff; extern int regvar; extern int minrvar; extern int brkflag; --- 124,140 ---- extern double dcon; extern char ftitle[]; + #ifndef LINT extern char ititle[]; + #endif extern struct symtab stab[]; extern int curftn; extern int curclass; extern int curdim; ! extern OFFSZ dimtab[]; ! extern OFFSZ paramstk[]; extern int paramno; ! extern OFFSZ autooff, argoff, strucoff; extern int regvar; extern int minrvar; extern int brkflag; diff -c mip.vax/pass2.h mip/pass2.h *** mip.vax/pass2.h Tue Apr 2 14:56:28 1985 --- mip/pass2.h Sat Jul 20 17:59:39 1991 *************** *** 197,206 **** #endif /* macros for doing double indexing */ ! #define R2PACK(x,y,z) (0200*((x)+1)+y+040000*z) /* pack 3 regs */ #define R2UPK1(x) ((((x)>>7)-1)&0177) /* unpack reg 1 */ #define R2UPK2(x) ((x)&0177) /* unpack reg 2 */ - #define R2UPK3(x) (x>>14) /* unpack reg 3 */ #define R2TEST(x) ((x)>=0200) /* test if packed */ #ifdef MULTILEVEL --- 197,205 ---- #endif /* macros for doing double indexing */ ! #define R2PACK(x,y) (0200*((x)+1)+y) /* pack 2 regs */ #define R2UPK1(x) ((((x)>>7)-1)&0177) /* unpack reg 1 */ #define R2UPK2(x) ((x)&0177) /* unpack reg 2 */ #define R2TEST(x) ((x)>=0200) /* test if packed */ #ifdef MULTILEVEL diff -c mip.vax/pftn.c mip/pftn.c *** mip.vax/pftn.c Tue Nov 24 12:57:17 1987 --- mip/pftn.c Sat Aug 17 16:58:56 1991 *************** *** 1,16 **** ! #ifndef lint static char *sccsid ="@(#)pftn.c 1.12 (Berkeley) 4/21/86"; #endif lint # include "pass1.h" ! unsigned int offsz; struct symtab *schain[MAXSCOPES]; /* sym chains for clearst */ int chaintop; /* highest active entry */ struct instk { ! int in_sz; /* size of array element */ int in_x; /* current index for structure member in structure initializations */ int in_n; /* number of initializations seen */ int in_s; /* sizoff */ --- 1,16 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)pftn.c 1.12 (Berkeley) 4/21/86"; #endif lint # include "pass1.h" ! OFFSZ offsz; struct symtab *schain[MAXSCOPES]; /* sym chains for clearst */ int chaintop; /* highest active entry */ struct instk { ! OFFSZ in_sz; /* size of array element */ int in_x; /* current index for structure member in structure initializations */ int in_n; /* number of initializations seen */ int in_s; /* sizoff */ *************** *** 147,153 **** /* redefinition */ if( !falloc( p, class&FLDSIZ, 1, NIL ) ) { /* successful allocation */ ! psave( idp ); return; } /* blew it: resume at end of switch... */ --- 147,153 ---- /* redefinition */ if( !falloc( p, class&FLDSIZ, 1, NIL ) ) { /* successful allocation */ ! psave( (OFFSZ)idp ); return; } /* blew it: resume at end of switch... */ *************** *** 184,190 **** case LABEL: if( scl == ULABEL ){ p->sclass = LABEL; ! deflab( p->offset ); return; } break; --- 184,190 ---- case LABEL: if( scl == ULABEL ){ p->sclass = LABEL; ! deflab( (int)p->offset ); return; } break; *************** *** 210,216 **** if( scl == class ) { if( oalloc( p, &strucoff ) ) break; if( class == MOU ) strucoff = 0; ! psave( idp ); return; } break; --- 210,216 ---- if( scl == class ) { if( oalloc( p, &strucoff ) ) break; if( class == MOU ) strucoff = 0; ! psave( (OFFSZ)idp ); return; } break; *************** *** 218,224 **** case MOE: if( scl == class ){ if( p->offset!= strucoff++ ) break; ! psave( idp ); } break; --- 218,224 ---- case MOE: if( scl == class ){ if( p->offset!= strucoff++ ) break; ! psave( (OFFSZ)idp ); } break; *************** *** 250,256 **** /* allow nonunique structure/union member names */ if( class==MOU || class==MOS || class & FIELD ){/* make a new entry */ ! register int *memp; p->sflags |= SNONUNIQ; /* old entry is nonunique */ /* determine if name has occurred in this structure/union */ if (paramno > 0) for( memp = ¶mstk[paramno-1]; --- 250,256 ---- /* allow nonunique structure/union member names */ if( class==MOU || class==MOS || class & FIELD ){/* make a new entry */ ! register OFFSZ *memp; p->sflags |= SNONUNIQ; /* old entry is nonunique */ /* determine if name has occurred in this structure/union */ if (paramno > 0) for( memp = ¶mstk[paramno-1]; *************** *** 303,312 **** p->suse = lineno; if( class == STNAME || class == UNAME || class == ENAME ) { p->sizoff = curdim; ! dstash( 0 ); /* size */ ! dstash( -1 ); /* index to members of str or union */ ! dstash( ALSTRUCT ); /* alignment */ ! dstash( idp ); } else { switch( BTYPE(type) ){ --- 303,312 ---- p->suse = lineno; if( class == STNAME || class == UNAME || class == ENAME ) { p->sizoff = curdim; ! dstash( (OFFSZ)0 ); /* size */ ! dstash( (OFFSZ)-1 ); /* index to members of str or union */ ! dstash( (OFFSZ)ALSTRUCT ); /* alignment */ ! dstash( (OFFSZ)idp ); } else { switch( BTYPE(type) ){ *************** *** 327,333 **** /* allocate offsets */ if( class&FIELD ){ falloc( p, class&FLDSIZ, 0, NIL ); /* new entry */ ! psave( idp ); } else switch( class ){ --- 327,333 ---- /* allocate offsets */ if( class&FIELD ){ falloc( p, class&FLDSIZ, 0, NIL ); /* new entry */ ! psave( (OFFSZ)idp ); } else switch( class ){ *************** *** 345,351 **** p->slevel = 2; if( class == LABEL ){ locctr( PROG ); ! deflab( p->offset ); } break; --- 345,351 ---- p->slevel = 2; if( class == LABEL ){ locctr( PROG ); ! deflab( (int)p->offset ); } break; *************** *** 359,370 **** case MOS: oalloc( p, &strucoff ); if( class == MOU ) strucoff = 0; ! psave( idp ); break; case MOE: p->offset = strucoff++; ! psave( idp ); break; case REGISTER: p->offset = regvar--; --- 359,370 ---- case MOS: oalloc( p, &strucoff ); if( class == MOU ) strucoff = 0; ! psave( (OFFSZ)idp ); break; case MOE: p->offset = strucoff++; ! psave( (OFFSZ)idp ); break; case REGISTER: p->offset = regvar--; *************** *** 395,401 **** } ! psave( i ){ if( paramno >= PARAMSZ ){ cerror( "parameter stack overflow"); } --- 395,401 ---- } ! psave( i ) OFFSZ i;{ if( paramno >= PARAMSZ ){ cerror( "parameter stack overflow"); } *************** *** 428,434 **** } dclargs(){ ! register i, j; register struct symtab *p; register NODE *q; argoff = ARGINIT; --- 428,435 ---- } dclargs(){ ! register i; ! OFFSZ j; register struct symtab *p; register NODE *q; argoff = ARGINIT; *************** *** 447,453 **** # endif if( p->stype == FARG ) { q = block(FREE,NIL,NIL,INT,0,INT); ! q->tn.rval = j; defid( q, PARAM ); } FIXARG(p); /* local arg hook, eg. for sym. debugger */ --- 448,454 ---- # endif if( p->stype == FARG ) { q = block(FREE,NIL,NIL,INT,0,INT); ! q->tn.rval = (int)j; defid( q, PARAM ); } FIXARG(p); /* local arg hook, eg. for sym. debugger */ *************** *** 504,511 **** bstruct( idn, soru ){ /* begining of structure or union declaration */ register NODE *q; ! psave( instruct ); ! psave( curclass ); psave( strucoff ); strucoff = 0; instruct = soru; --- 505,512 ---- bstruct( idn, soru ){ /* begining of structure or union declaration */ register NODE *q; ! psave( (OFFSZ)instruct ); ! psave( (OFFSZ)curclass ); psave( strucoff ); strucoff = 0; instruct = soru; *************** *** 526,532 **** q->in.type = ENUMTY; if( idn >= 0 ) defid( q, ENAME ); } ! psave( idn = q->tn.rval ); /* the "real" definition is where the members are seen */ if ( idn >= 0 ) stab[idn].suse = lineno; return( paramno-4 ); --- 527,533 ---- q->in.type = ENUMTY; if( idn >= 0 ) defid( q, ENAME ); } ! psave( (OFFSZ)(idn = q->tn.rval) ); /* the "real" definition is where the members are seen */ if ( idn >= 0 ) stab[idn].suse = lineno; return( paramno-4 ); *************** *** 535,543 **** NODE * dclstruct( oparam ){ register struct symtab *p; ! register i, al, sa, j, sz, szindex; register TWORD temp; ! register high, low; /* paramstack contains: paramstack[ oparam ] = previous instruct --- 536,546 ---- NODE * dclstruct( oparam ){ register struct symtab *p; ! register sa, al; ! int szindex; ! OFFSZ sz, i, j; register TWORD temp; ! OFFSZ high, low; /* paramstack contains: paramstack[ oparam ] = previous instruct *************** *** 549,561 **** */ - if( (i=paramstk[oparam+3]) < 0 ){ szindex = curdim; ! dstash( 0 ); /* size */ ! dstash( -1 ); /* index to member names */ ! dstash( ALSTRUCT ); /* alignment */ ! dstash( -lineno ); /* name of structure */ } else { szindex = stab[i].sizoff; --- 552,563 ---- */ if( (i=paramstk[oparam+3]) < 0 ){ szindex = curdim; ! dstash( (OFFSZ)0 ); /* size */ ! dstash( (OFFSZ)-1 ); /* index to member names */ ! dstash( (OFFSZ)ALSTRUCT ); /* alignment */ ! dstash( (OFFSZ)-lineno ); /* name of structure */ } else { szindex = stab[i].sizoff; *************** *** 606,612 **** SETOFF( al, sa ); /* set al, the alignment, to the lcm of the alignments of the members */ } ! dstash( -1 ); /* endmarker */ SETOFF( strucoff, al ); if( temp == ENUMTY ){ --- 608,614 ---- SETOFF( al, sa ); /* set al, the alignment, to the lcm of the alignments of the members */ } ! dstash( (OFFSZ)-1 ); /* endmarker */ SETOFF( strucoff, al ); if( temp == ENUMTY ){ *************** *** 631,643 **** FIXSTRUCT( szindex, oparam ); /* local hook, eg. for sym debugger */ # ifndef BUG1 if( ddebug>1 ){ ! printf( "\tdimtab[%d,%d,%d] = %d,%d,%d\n", szindex,szindex+1,szindex+2, dimtab[szindex],dimtab[szindex+1],dimtab[szindex+2] ); ! for( i = dimtab[szindex+1]; dimtab[i] >= 0; ++i ){ #ifndef FLEXNAMES ! printf( "\tmember %.8s(%d)\n", stab[dimtab[i]].sname, dimtab[i] ); #else ! printf( "\tmember %s(%d)\n", stab[dimtab[i]].sname, dimtab[i] ); #endif } } --- 633,645 ---- FIXSTRUCT( szindex, oparam ); /* local hook, eg. for sym debugger */ # ifndef BUG1 if( ddebug>1 ){ ! printf( "\tdimtab[%d,%d,%d] = %ld,%ld,%ld\n", szindex,szindex+1,szindex+2, dimtab[szindex],dimtab[szindex+1],dimtab[szindex+2] ); ! for( i = (int)dimtab[szindex+1]; dimtab[i] >= 0; ++i ){ #ifndef FLEXNAMES ! printf( "\tmember %.8s(%ld)\n", stab[dimtab[i]].sname, dimtab[i] ); #else ! printf( "\tmember %s(%ld)\n", stab[dimtab[i]].sname, dimtab[i] ); #endif } } *************** *** 686,692 **** } stab[idn].stype = FARG; stab[idn].sclass = PARAM; ! psave( idn ); } talign( ty, s) register unsigned ty; register s; { --- 688,694 ---- } stab[idn].stype = FARG; stab[idn].sclass = PARAM; ! psave( (OFFSZ)idn ); } talign( ty, s) register unsigned ty; register s; { *************** *** 758,764 **** case PTR: return( SZPOINT * mult ); case ARY: ! mult *= (unsigned int) dimtab[ d++ ]; continue; case 0: break; --- 760,766 ---- case PTR: return( SZPOINT * mult ); case ARY: ! mult *= dimtab[ d++ ]; continue; case 0: break; *************** *** 773,779 **** uerror( "unknown size"); return( SZINT ); } ! return( (unsigned int) dimtab[ s ] * mult ); } inforce( n ) OFFSZ n; { /* force inoff to have the value n */ --- 775,781 ---- uerror( "unknown size"); return( SZINT ); } ! return( dimtab[ s ] * mult ); } inforce( n ) OFFSZ n; { /* force inoff to have the value n */ *************** *** 816,822 **** } ! vfdalign( n ){ /* make inoff have the offset the next alignment of n */ OFFSZ m; m = inoff; --- 818,824 ---- } ! vfdalign( n ) OFFSZ n;{ /* make inoff have the offset the next alignment of n */ OFFSZ m; m = inoff; *************** *** 881,887 **** for(;;){ # ifndef BUG1 ! if( idebug ) printf( "instk((%d, %o,%d,%d, %d)\n", id, t, d, s, off ); # endif /* save information on the stack */ --- 883,889 ---- for(;;){ # ifndef BUG1 ! if( idebug ) printf( "instk((%d, %o,%d,%d, %ld)\n", id, t, d, s, off ); # endif /* save information on the stack */ *************** *** 925,931 **** iclass = -1; return; } ! id = dimtab[pstk->in_x]; p = &stab[id]; if( p->sclass != MOS && !(p->sclass&FIELD) ) cerror( "insane structure member list" ); t = p->stype; --- 927,933 ---- iclass = -1; return; } ! id = (int)dimtab[pstk->in_x]; p = &stab[id]; if( p->sclass != MOS && !(p->sclass&FIELD) ) cerror( "insane structure member list" ); t = p->stype; *************** *** 952,958 **** inforce( pstk->in_off ); /* if the array is inflexible (not top level), pass in the size and be prepared to throw away unwanted initializers */ ! lxstr((pstk-1)!=instack?dimtab[(pstk-1)->in_d]:0); /* get the contents */ irbrace(); /* simulate } */ return( NIL ); } --- 954,960 ---- inforce( pstk->in_off ); /* if the array is inflexible (not top level), pass in the size and be prepared to throw away unwanted initializers */ ! lxstr((pstk-1)!=instack?(int)dimtab[(pstk-1)->in_d]:0); /* get the contents */ irbrace(); /* simulate } */ return( NIL ); } *************** *** 959,965 **** else { /* make a label, and get the contents and stash them away */ if( iclass != SNULL ){ /* initializing */ /* fill out previous word, to permit pointer */ ! vfdalign( ALPOINT ); } temp = locctr( blevel==0?ISTRNG:STRNG ); /* set up location counter */ deflab( l = getlab() ); --- 961,967 ---- else { /* make a label, and get the contents and stash them away */ if( iclass != SNULL ){ /* initializing */ /* fill out previous word, to permit pointer */ ! vfdalign( (OFFSZ)ALPOINT ); } temp = locctr( blevel==0?ISTRNG:STRNG ); /* set up location counter */ deflab( l = getlab() ); *************** *** 982,991 **** endinit(){ register TWORD t; ! register d, s, n, d1; # ifndef BUG1 ! if( idebug ) printf( "endinit(), inoff = %d\n", inoff ); # endif switch( iclass ){ --- 984,994 ---- endinit(){ register TWORD t; ! register d, n, d1; ! int s; # ifndef BUG1 ! if( idebug ) printf( "endinit(), inoff = %ld\n", inoff ); # endif switch( iclass ){ *************** *** 1005,1011 **** n = pstk->in_n; if( ISARY(t) ){ ! d1 = dimtab[d]; vfdalign( pstk->in_sz ); /* fill out part of the last element, if needed */ n = inoff/pstk->in_sz; /* real number of initializers */ --- 1008,1014 ---- n = pstk->in_n; if( ISARY(t) ){ ! d1 = (int)dimtab[d]; vfdalign( pstk->in_sz ); /* fill out part of the last element, if needed */ n = inoff/pstk->in_sz; /* real number of initializers */ *************** *** 1029,1035 **** else inforce( tsize(t,d,s) ); paramno = 0; ! vfdalign( AL_INIT ); inoff = 0; iclass = SNULL; --- 1032,1038 ---- else inforce( tsize(t,d,s) ); paramno = 0; ! vfdalign( (OFFSZ)AL_INIT ); inoff = 0; iclass = SNULL; *************** *** 1041,1047 **** /* inoff has the current offset (last bit written) in the current word being generated */ ! register sz, d, s; register TWORD t; int o; --- 1044,1051 ---- /* inoff has the current offset (last bit written) in the current word being generated */ ! register d, s; ! OFFSZ sz; register TWORD t; int o; *************** *** 1142,1148 **** if( t == STRTY ){ ix = ++pstk->in_x; ! if( (id=dimtab[ix]) < 0 ) continue; /* otherwise, put next element on the stack */ --- 1146,1152 ---- if( t == STRTY ){ ix = ++pstk->in_x; ! if( (id=(int)dimtab[ix]) < 0 ) continue; /* otherwise, put next element on the stack */ *************** *** 1219,1230 **** } ! upoff( size, alignment, poff ) register alignment, *poff; { /* update the offset pointed to by poff; return the /* offset of a value of size `size', alignment `alignment', /* given that off is increasing */ ! register off; off = *poff; SETOFF( off, alignment ); --- 1223,1235 ---- } ! OFFSZ ! upoff( size, alignment, poff ) OFFSZ size; register alignment; register OFFSZ *poff; { /* update the offset pointed to by poff; return the /* offset of a value of size `size', alignment `alignment', /* given that off is increasing */ ! OFFSZ off; off = *poff; SETOFF( off, alignment ); *************** *** 1236,1245 **** return( off ); } ! oalloc( p, poff ) register struct symtab *p; register *poff; { /* allocate p with offset *poff, and update *poff */ ! register al, off, tsz; ! int noff; al = talign( p->stype, p->sizoff ); noff = off = *poff; --- 1241,1250 ---- return( off ); } ! oalloc( p, poff ) register struct symtab *p; register OFFSZ *poff; { /* allocate p with offset *poff, and update *poff */ ! OFFSZ al, off, tsz; ! OFFSZ noff; al = talign( p->stype, p->sizoff ); noff = off = *poff; *************** *** 1254,1260 **** else #endif if( p->sclass == PARAM && ( tsz < SZINT ) ){ ! off = upoff( SZINT, ALINT, &noff ); # ifndef RTOLBYTES off = noff - tsz; #endif --- 1259,1265 ---- else #endif if( p->sclass == PARAM && ( tsz < SZINT ) ){ ! off = upoff( (OFFSZ)SZINT, ALINT, &noff ); # ifndef RTOLBYTES off = noff - tsz; #endif *************** *** 1261,1267 **** } else { ! off = upoff( tsz, al, &noff ); } if( p->sclass != REGISTER ){ /* in case we are allocating stack space for register arguments */ --- 1266,1272 ---- } else { ! off = upoff( tsz, (int)al, &noff ); } if( p->sclass != REGISTER ){ /* in case we are allocating stack space for register arguments */ *************** *** 1512,1518 **** /* build a type, and stash away dimensions, from a parse tree of the declaration */ /* the type is build top down, the dimensions bottom up */ ! register o, temp; register unsigned t; o = p->in.op; --- 1517,1524 ---- /* build a type, and stash away dimensions, from a parse tree of the declaration */ /* the type is build top down, the dimensions bottom up */ ! register o; ! CONSZ temp; register unsigned t; o = p->in.op; *************** *** 1736,1742 **** /* look up name: must agree with s w.r.t. STAG, SMOS and SHIDDEN */ register char *p, *q; ! int i, j, ii; register struct symtab *sp; /* compute initial hash index */ --- 1742,1748 ---- /* look up name: must agree with s w.r.t. STAG, SMOS and SHIDDEN */ register char *p, *q; ! unsigned int i, j, ii; register struct symtab *sp; /* compute initial hash index */ diff -c mip.vax/reader.c mip/reader.c *** mip.vax/reader.c Sun Aug 25 16:55:54 1985 --- mip/reader.c Sat Aug 17 17:00:46 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)reader.c 4.4 (Berkeley) 8/22/85"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)reader.c 4.4 (Berkeley) 8/22/85"; #endif lint *************** *** 124,131 **** # ifndef NOMAIN ! unsigned int caloff(); ! unsigned int offsz; mainp2( argc, argv ) char *argv[]; { register files; register temp; --- 124,131 ---- # ifndef NOMAIN ! OFFSZ caloff(); ! OFFSZ offsz; mainp2( argc, argv ) char *argv[]; { register files; register temp; *************** *** 148,154 **** } while( (c=getchar()) > 0 ) switch( c ){ case ')': - default: /* copy line unchanged */ if ( c != ')' ) PUTCHAR( c ); /* initial tab */ --- 148,153 ---- *************** *** 161,167 **** case BBEG: /* beginning of a block */ temp = rdin(10); /* ftnno */ ! tmpoff = baseoff = (unsigned int) rdin(10); /* autooff for block gives max offset of autos in block */ maxtreg = rdin(10); if( getchar() != '\n' ) cerror( "intermediate file format error"); --- 160,166 ---- case BBEG: /* beginning of a block */ temp = rdin(10); /* ftnno */ ! tmpoff = baseoff = rdin(10); /* autooff for block gives max offset of autos in block */ maxtreg = rdin(10); if( getchar() != '\n' ) cerror( "intermediate file format error"); diff -c mip.vax/scan.c mip/scan.c *** mip.vax/scan.c Wed Apr 23 22:44:34 1986 --- mip/scan.c Sat Aug 17 17:02:12 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)scan.c 2.1 (Berkeley) 4/23/86"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)scan.c 2.1 (Berkeley) 4/23/86"; #endif lint *************** *** 56,62 **** #ifndef FLEXNAMES # define LXTSZ 100 #else ! #define LXTSZ BUFSIZ #endif char yytext[LXTSZ]; char * lxgcp; --- 56,62 ---- #ifndef FLEXNAMES # define LXTSZ 100 #else ! #define LXTSZ 512 /* was BUFSIZ */ #endif char yytext[LXTSZ]; char * lxgcp; *************** *** 70,76 **** extern int lastloc; #endif ! unsigned caloff(); /* ARGSUSED */ mainp1( argc, argv ) int argc; char *argv[]; { /* control multiple files */ --- 70,76 ---- extern int lastloc; #endif ! OFFSZ caloff(); /* ARGSUSED */ mainp1( argc, argv ) int argc; char *argv[]; { /* control multiple files */ *************** *** 78,86 **** register char *cp; extern int idebug, bdebug, tdebug, edebug; extern int ddebug, xdebug, gdebug, adebug; ! extern unsigned int offsz; int fdef = 0; ! char *release = "PCC/2.1 (Berkeley) 4/23/86"; offsz = caloff(); for( i=1; ifn.csiz+1)<0 ) cerror( "undefined structure or union" ); ! else if( !chkstr( i, dimtab[j], DECREF(l->in.type) ) ){ #ifndef FLEXNAMES werror( "illegal member use: %.8s", stab[i].sname ); #else --- 405,411 ---- else werror( "struct/union or struct/union pointer required" ); } else if( (j=l->fn.csiz+1)<0 ) cerror( "undefined structure or union" ); ! else if( !chkstr( i, (int)dimtab[j], DECREF(l->in.type) ) ){ #ifndef FLEXNAMES werror( "illegal member use: %.8s", stab[i].sname ); #else *************** *** 617,623 **** # endif if( (k = j) < 0 ) uerror( "undefined structure or union" ); else { ! for( ; (kk = dimtab[k] ) >= 0; ++k ){ if( kk >= SYMTSZ ){ cerror( "gummy structure" ); return(1); --- 617,623 ---- # endif if( (k = j) < 0 ) uerror( "undefined structure or union" ); else { ! for( ; (kk = (int)dimtab[k] ) >= 0; ++k ){ if( kk >= SYMTSZ ){ cerror( "gummy structure" ); return(1); *************** *** 628,634 **** case STRTY: case UNIONTY: if( type == STRTY ) continue; /* no recursive looking for strs */ ! if( hflag && chkstr( i, dimtab[stab[kk].sizoff+1], stab[kk].stype ) ){ if( stab[kk].sname[0] == '$' ) return(0); /* $FAKE */ werror( #ifndef FLEXNAMES --- 628,634 ---- case STRTY: case UNIONTY: if( type == STRTY ) continue; /* no recursive looking for strs */ ! if( hflag && chkstr( i, (int)dimtab[stab[kk].sizoff+1], stab[kk].stype ) ){ if( stab[kk].sname[0] == '$' ) return(0); /* $FAKE */ werror( #ifndef FLEXNAMES *************** *** 898,904 **** } NODE * ! bcon( i ){ /* make a constant node with value i */ register NODE *p; p = block( ICON, NIL, NIL, INT, 0, INT ); --- 898,904 ---- } NODE * ! bcon( i ) int i;{ /* make a constant node with value i */ register NODE *p; p = block( ICON, NIL, NIL, INT, 0, INT ); *************** *** 1678,1684 **** case STCALL: case UNARY STCALL: /* set up size parameters */ ! p->stn.stsize = (tsize(STRTY,p->in.left->fn.cdim,p->in.left->fn.csiz)+SZCHAR-1)/SZCHAR; p->stn.stalign = talign(STRTY,p->in.left->fn.csiz)/SZCHAR; break; --- 1678,1684 ---- case STCALL: case UNARY STCALL: /* set up size parameters */ ! p->stn.stsize = (tsize(STRTY,p->in.left->fn.cdim, (OFFSZ)p->in.left->fn.csiz)+SZCHAR-1)/SZCHAR; p->stn.stalign = talign(STRTY,p->in.left->fn.csiz)/SZCHAR; break; diff -c mip.vax/xdefs.c mip/xdefs.c *** mip.vax/xdefs.c Tue Mar 19 16:10:51 1985 --- mip/xdefs.c Sat Aug 17 17:06:32 1991 *************** *** 1,4 **** ! #ifndef lint static char *sccsid ="@(#)xdefs.c 4.3 (Berkeley) 3/19/85"; #endif lint --- 1,4 ---- ! #if !defined(lint) && defined(DOSCCS) static char *sccsid ="@(#)xdefs.c 4.3 (Berkeley) 3/19/85"; #endif lint *************** *** 6,13 **** /* communication between lexical routines */ ! char ftitle[100] = ""; /* title of the file */ ! char ititle[100] = ""; /* title of initial file */ int lineno; /* line number of the input file */ CONSZ lastcon; /* the last constant read by the lexical analyzer */ --- 6,15 ---- /* communication between lexical routines */ ! char ftitle[100]; /* title of the file */ ! #ifndef LINT ! char ititle[100]; /* title of initial file */ ! #endif int lineno; /* line number of the input file */ CONSZ lastcon; /* the last constant read by the lexical analyzer */ *************** *** 28,39 **** blevel, /* block level: 0 for extern, 1 for ftn args, >=2 inside function */ curdim; /* current offset into the dimension table */ ! int dimtab[ DIMTABSZ ]; ! int paramstk[ PARAMSZ ]; /* used in the definition of function parameters */ int paramno; /* the number of parameters */ ! int autooff, /* the next unused automatic offset */ ! argoff, /* the next unused argument offset */ strucoff; /* the next structure offset position */ int regvar; /* the next free register for register variables */ int minrvar; /* the smallest that regvar gets witing a function */ --- 30,47 ---- blevel, /* block level: 0 for extern, 1 for ftn args, >=2 inside function */ curdim; /* current offset into the dimension table */ ! OFFSZ dimtab[ DIMTABSZ ]; /* same comments as below. bit addressing ! * everything forces this to be large. ! */ ! OFFSZ paramstk[ PARAMSZ ]; /* used in definition of function parameters */ ! /* ordinarily 'int' would be enough, but the ! * "bit address" in 'strucoff' (for structures ! * over 4kb) needs a 'long' *sigh* ! */ int paramno; /* the number of parameters */ ! OFFSZ autooff, /* the next unused automatic offset */ ! argoff, /* the next unused argument offset */ strucoff; /* the next structure offset position */ int regvar; /* the next free register for register variables */ int minrvar; /* the smallest that regvar gets witing a function */