--- cci/usr/src/lib/fpcc/code.c 2019/07/28 12:24:19 1.1.1.1 +++ cci/usr/src/lib/fpcc/code.c 2019/07/28 12:24:49 1.1.1.2 @@ -2,6 +2,7 @@ # include # include # include +# include int proflg = 0; /* are we generating profiling code? */ int strftn = 0; /* is the current function one which returns a value */ @@ -17,7 +18,7 @@ branch( n ){ /* exception is an ordinary function branching to retlab: then, return */ if( n == retlab && !strftn ){ register TWORD t; - register r; + register int r; /* set number of regs in assem comment field */ /* so optimizers can do a better job */ r = 0; @@ -46,7 +47,7 @@ defalign(n) { } locctr( l ){ - register temp; + register int temp; /* l is PROG, ADATA, DATA, STRNG, ISTRNG, or STAB */ if( l == lastloc ) return(l); @@ -153,8 +154,8 @@ int ftlab1, ftlab2; bfcode( a, n ) int a[]; { /* code for the beginning of a function; a is an array of indices in stab for the arguments; n is the number */ - register i; - register temp; + register int i; + register int temp; register struct symtab *p; int off; #ifdef REG_CHAR @@ -237,6 +238,32 @@ bfcode( a, n ) int a[]; { fdefflag = 1; } + +beg_file() { + /* called as the very first thing by the parser to do machine + * dependent stuff + */ + extern fpe_catch(); + register char * p; + register char * s; + + /* note: double quotes already in ftitle... */ + /* + * Catch floating exceptions generated by the constant + * folding code. + */ + (void) signal( SIGFPE, fpe_catch ); + } + +fpe_catch() { + /* + * Floating exception generated by constant folding. + */ + /* "floating point constant folding causes exception" */ + fprintf( stderr, "floating point constant folding causes exception\n"); + exit(1); + } + bccode(){ /* called just before the first executable statment */ /* by now, the automatics and register variables are allocated */ SETOFF( autooff, SZINT ); @@ -392,10 +419,10 @@ genswitch(p,n) register struct sw *p;{ its value is the label number The entries p[1] to p[n] are the nontrivial cases */ - register i; + register int i; register CONSZ j; register CONSZ unsigned range; - register dlab, swlab; + register int dlab, swlab; range = p[n].sval-p[1].sval;