home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / linux / 24992 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.9 KB  |  39 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds
  3. From: torvalds@klaava.Helsinki.FI (Linus Torvalds)
  4. Subject: Re: GCC - matherr(), what about it ?
  5. Message-ID: <1993Jan21.162243.17093@klaava.Helsinki.FI>
  6. Organization: University of Helsinki
  7. References: <1jmedsINNhpd@news.cs.tu-berlin.de>
  8. Date: Thu, 21 Jan 1993 16:22:43 GMT
  9. Lines: 28
  10.  
  11. In article <1jmedsINNhpd@news.cs.tu-berlin.de> kk@cs.tu-berlin.de (Kolja Kaehler) writes:
  12. >When compiling pov-ray, gcc failed for the symbols DOMAIN, SING, UNDERFLOW and
  13. >OVERFLOW which were used in a function called 'matherr()'.
  14. >(I wasn't able to find a prototype for this in math.h or any other place ...) 
  15. >I don't *know* what this is meant to do, but I suppose one can use matherr()
  16. >to trap math exceptions ? I removed the whole thing from the povray source,
  17. >(still works - so far) but ... does gcc really not support it ? (using 2.3.3)
  18.  
  19. The current kernel does not support math state saving when encountering
  20. an error: I simply didn't know what to do with the data, so I just
  21. discard it.  The latest kernel versions do a "fninit" when a math error
  22. occurs (as well as sending the SIGFPE, of course) to clear any error -
  23. older kernels just did a fcnlex.  This essentially means that there is
  24. no way to find out why the error happened unless you check the
  25. operations before executing them. 
  26.  
  27. The reason is, of course, that it's not covered by any standard as far
  28. as I know, and I haven't got a clue about how "normal" 386 unixes handle
  29. it.  Just as well, mostly, as the way to handle FPU exceptions is either
  30. to abort on them or use longjmps to restore the machine to some known
  31. state and continuing from there.  That at least is portable. 
  32.  
  33. So don't blame gcc - while I don't know what matherr() is supposed to
  34. do, I'd assume it needs help from the kernel in order to get at the FPU
  35. state.  Sysv-i386 probably saves the math state somewhere on the user
  36. stack or similar. 
  37.  
  38.         Linus
  39.