home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / gcc / bug / 3047 < prev    next >
Encoding:
Text File  |  1992-12-23  |  2.2 KB  |  73 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: 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
  3. From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
  4. Subject: Floating point bug on 386BSD
  5. Message-ID: <Pine.3.05.9212231052.A28613-b100000@hal.gnu.ai.mit.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Wed, 23 Dec 1992 05:56:52 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 60
  12.  
  13. While building stage 1 on a machine running 386BSD:
  14.  
  15. bsdsux # ./xgcc -B./ -O0 -c foo.c
  16. ./xgcc: Internal compiler error: program cc1 got fatal signal 6
  17. bsdsux # ./xgcc -DSECOND -B./ -O0 -c foo.c
  18. foo.c: In function `fprop':
  19. foo.c:30: floating constant out of range
  20. bsdsux # 
  21.  
  22. `foo.c' originally came from `enquire.c'; the build failed because `enquire'
  23. wouldn't compile properly.
  24.  
  25. Note that this happens with both 2.3.2 and the sources in /gd2/cc.
  26.  
  27. -----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----
  28. int fprop (int bits_per_byte) ;
  29. void  efprop (int fprec, int dprec, int lprec) ;
  30.  
  31. int main(void) {
  32. }
  33.  
  34. void fStore (float a, float *b)  { *b=a; }
  35. #if SECOND
  36. float fSum (float a, float b) { return 0.0; }
  37. float fDiff (float a, float b) { return 0.0; }
  38. float fMul (float a, float b) { return 0.0; }
  39. #else
  40. float  fSum  (float   a,  float   b)  {float  r; fStore (a+b, &r); return (r); }
  41. float  fDiff  (float   a,  float   b) {float  r; fStore (a-b, &r); return (r); }
  42. float  fMul  (float   a,  float   b)  {float  r; fStore (a*b, &r); return (r); }
  43. #endif
  44. int fprop (bits_per_byte) int bits_per_byte; {
  45.      
  46.     volatile  int
  47.         f_mant_dig;
  48.     volatile  float 
  49.         a, b, base;
  50.      
  51.     b=1.0;
  52.     do { b=fSum (b, b); } while ((base=fDiff (fSum (a, b), a)) == 0.0 );
  53.      
  54.     f_mant_dig=0; b=1.0;
  55.     do { f_mant_dig++; b=fMul (b, base); }
  56.     while (fDiff (fDiff (fSum (b, 1.0 ), b), 1.0 ) == 0.0 );
  57.     return f_mant_dig;
  58. }
  59. void  efprop (fprec, dprec, lprec) int fprec, dprec, lprec; {
  60.      
  61.     volatile  int eprec;
  62.     volatile  double base;
  63.     volatile  float  d, oldd, dbase, one, zero;
  64.      
  65.         eprec=0; d=1.0; dbase=base; one=1.0; zero=0.0;
  66.             do { eprec++; oldd=d; d=d*dbase; }
  67.             while ((((d+one)-d)-one) == zero && d>oldd);
  68. }
  69. -----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----
  70.  
  71.  
  72.  
  73.