🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Charles Hannum Wed, 23 Dec 1992 05:56
Floating point bug on 386BSD
#1453
Author: Charles Hannum
Date: Wed, 23 Dec 1992 05:56
57 lines
2328 bytes
While building stage 1 on a machine running 386BSD:

bsdsux # ./xgcc -B./ -O0 -c foo.c
./xgcc: Internal compiler error: program cc1 got fatal signal 6
bsdsux # ./xgcc -DSECOND -B./ -O0 -c foo.c
foo.c: In function `fprop':
foo.c:30: floating constant out of range
bsdsux # 

`foo.c' originally came from `enquire.c'; the build failed because `enquire'
wouldn't compile properly.

Note that this happens with both 2.3.2 and the sources in /gd2/cc.

-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----
int fprop (int bits_per_byte) ;
void  efprop (int fprec, int dprec, int lprec) ;
 
int main(void) {
}
 
void fStore (float a, float *b)  { *b=a; }
#if SECOND
float fSum (float a, float b) { return 0.0; }
float fDiff (float a, float b) { return 0.0; }
float fMul (float a, float b) { return 0.0; }
#else
float  fSum  (float   a,  float   b)  {float  r; fStore (a+b, &r); return (r); }
float  fDiff  (float   a,  float   b) {float  r; fStore (a-b, &r); return (r); }
float  fMul  (float   a,  float   b)  {float  r; fStore (a*b, &r); return (r); }
#endif
int fprop (bits_per_byte) int bits_per_byte; {
	 
	volatile  int
		f_mant_dig;
	volatile  float 
		a, b, base;
	 
	b=1.0;
	do { b=fSum (b, b); } while ((base=fDiff (fSum (a, b), a)) == 0.0 );
	 
	f_mant_dig=0; b=1.0;
	do { f_mant_dig++; b=fMul (b, base); }
	while (fDiff (fDiff (fSum (b, 1.0 ), b), 1.0 ) == 0.0 );
	return f_mant_dig;
}
void  efprop (fprec, dprec, lprec) int fprec, dprec, lprec; {
	 
	volatile  int eprec;
	volatile  double base;
	volatile  float  d, oldd, dbase, one, zero;
	 
		eprec=0; d=1.0; dbase=base; one=1.0; zero=0.0;
			do { eprec++; oldd=d; d=d*dbase; }
			while ((((d+one)-d)-one) == zero && d>oldd);
}
-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads