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