home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sun.misc:3373 comp.unix.wizards:3338
- Newsgroups: comp.sys.sun.misc,comp.unix.wizards
- Path: sparky!uunet!shearson.com!news
- From: pmetzger@shearson.com (Perry E. Metzger)
- Subject: getting SIGFPE working right
- Message-ID: <1992Jul28.203716.14289@shearson.com>
- Sender: news@shearson.com (News)
- Organization: Lehman Brothers
- Date: Tue, 28 Jul 1992 20:37:16 GMT
- Lines: 31
-
- Hello, all.
-
- This is an odd one. After years of writing C code that never cared a
- damn about arithmetic exceptions, I suddenly found myself caring and
- vaguely remembered some signal that handled this. A quick look at the
- man page for sigvec revealed SIGFPE, which is supposed to catch
- floating point and some integer exceptions. So far, so good, only, I
- found at first that it didn't work. Some study found the -fnonstd flag
- for the compiler (SunOS 4.1.1, standard compiler, by the way) which
- seems to make it work for at least some floating point exceptions, and
- SIGFPE seems to trigger fine on divide by zero in the integer space.
- So far, so good. Only, I'm still missing one case. Quoting from the
- sigvec manpage...
-
- SPARC codes:[...]
- Integer overflow SIGFPE FPE_INTOVF_TRAP
-
- Only, I can't for the life of me figure out the magic needed to get
- the compiler/everything else to actually send me this signal for
- integer overflow; I'd presume some special magic is needed as most of
- the time no one would care about overflow in C. Sadly, none of this
- stuff is properly documented, at least it isn't properly documented
- anywhere I've looked. Any clues, folks? And while I'm at it, is
- -fnonstd the right way to get SIGFPE to work, and any clue how to get
- all this running with gcc?
-
- --
- Perry Metzger pmetzger@shearson.com
- --
- Just say "NO!" to death and taxes.
- Extropian and Proud.
-