Article View: gnu.gcc.bug
Article #1453Floating point bug on 386BSD
From: Charles Hannum
Date: Wed, 23 Dec 1992 05:56
Date: Wed, 23 Dec 1992 05:56
57 lines
2328 bytes
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-----
Technical Details
Message-ID:
<Pine.3.05.9212231052.A28613-b100000@hal.gnu.ai.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!hal.gnu.ai.mit.edu!mycroftShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!hal.gnu.ai.mit.edu!mycroft From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum) Subject: Floating point bug on 386BSD Message-ID: <Pine.3.05.9212231052.A28613-b100000@hal.gnu.ai.mit.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 23 Dec 1992 05:56:52 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 60